This repository has been archived by the owner on Jul 3, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposes enforcing
flake8
's checks on for pull requests to be merged.In my experience,
flake8
is very helpful in detecting correctness and efficiency related issues such as:f-strings
And many more.
Changes
"resolves" the following
flake8
warnings by annotating them with#noqa
comments.Adds the latest version of
flake8
as a newpre-commit
task, ensuring that it's run in CI.Adds a root-level
setup.cfg
containing configuration forflake8
, including excluding some style-only warnings that are currently raised runningflake8 .
onmain
.Testing
Notes
Why
setup.cfg
instead of just adding configuration in.pre-commit-config.yaml
?Putting configuration for tools like
flake8
into the standard files used in Python projects (e.g.setup.cfg
orpyproject.toml
) decouples the configuration from the thing running the tool. e.g. if this project were to switch frompre-commit run
to aMakefile
or shell script for running these checks, none of theflake8
configuration would need to be moved.If maintainers feel strongly about not adding this file, I'd be happy to move this configuration back to
.pre-commit-config.yaml
.Thanks for your time and consideration!
Checklist
Testing checklist
Python - local testing