Skip to content

STYLE: pre-commit does not use flake8-comprehensions plugin #27724

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

Closed
jschendel opened this issue Aug 2, 2019 · 0 comments · Fixed by #27725
Closed

STYLE: pre-commit does not use flake8-comprehensions plugin #27724

jschendel opened this issue Aug 2, 2019 · 0 comments · Fixed by #27725
Labels
Code Style Code style, linting, code_checks
Milestone

Comments

@jschendel
Copy link
Member

We use flake8-comprehensions as part of the CI process when linting code, and it's included in our environment.yml file, but it's not run as part of pre-commit.

For a simple example, add the following line of code to a file in the codebase:

sum([x + 1 for x in range(3)])

Then in the command line run:

git add .
pre-commit run flake8

And the pre-commit check passes.

However, running flake8 from the command line (like what is done in CI) fails due to the flake8-comprehensions plugin being included:

flake8 path/to/changed/file.py

Gives me the error:

C407 Unnecessary list comprehension - 'sum' can take a generator.
@jschendel jschendel added the Code Style Code style, linting, code_checks label Aug 2, 2019
@jschendel jschendel added this to the 1.0 milestone Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant