-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flake8 scans failing on CI/CD pipelines #24935
Comments
This might be related to #24291 |
While that topic discusses tests, here we are failing during a flake8 scan. |
I think I attributed it incorrectly, sorry |
The C4 error codes were enabled a few weeks ago in gh-24741. It looks like there was a new release (3.11.0) of flake-comprehensions 12 hours ago: To reproduce locally you should update flake8-comprehensions:
We could pin the version of flake8-comprehensions in CI but it is good to get updates like this automatically. We could also choose to ignore C416 by setting that in pyproject.toml. Really though the problems it is complaining about seem like legitimate problems to me e.g.:
That should just be: free_map = dict(zip(editor.args_with_ind, free_indices[:-1])) Using I think the best fix is just to open a PR to change the code that flake8-comprehensions is complaining about. Once that is merged other PRs will pass CI. |
Yeah, I submitted an issue to ruff to add an autofixer, but no one has added it yet: astral-sh/ruff#3598 |
👍 Only about a dozen of lines sharing the same pattern, hence fixable manually. I have fixed it this way in the PR attached. |
My two cents are that autofixing may not be reliable. What to do with more sophisticated patterns such as dictionary reversion |
Those two dict comprehensions are fine and shouldn't flag the C416 rule I wrote anyway so it wouldn't trigger the autofixers anyhow. |
This is also demonstrated by my PR #24937 where all the tests pass after fixing a dozen of C416 patterns. |
On this note: where is a directive enforcing autofix? |
The autofixer is now available in the master of ruff and I've already tested it and used it to update all my codebases for anyone else having issues. |
CI/CD jobs in many PRs are failing when scanning the code with flake8.
The issue seems to break on the base code, not on PR-ed commits. Are flake8 rules pinned?
See
https://github.com/sympy/sympy/actions/runs/4456494418/jobs/7826977213?pr=24253#step:7:1
https://github.com/sympy/sympy/actions/runs/4456527846/jobs/7827030982
https://github.com/sympy/sympy/actions/runs/4456328202/jobs/7826700508
The text was updated successfully, but these errors were encountered: