This repository was archived by the owner on Jul 3, 2023. It is now read-only.
[ci] enforce flake8 (fixes #161)#222
Merged
elijahbenizzy merged 1 commit intostitchfix:mainfrom Oct 29, 2022
jameslamb:add-flake8
Merged
[ci] enforce flake8 (fixes #161)#222elijahbenizzy merged 1 commit intostitchfix:mainfrom jameslamb:add-flake8
elijahbenizzy merged 1 commit intostitchfix:mainfrom
jameslamb:add-flake8
Conversation
jameslamb
commented
Oct 29, 2022
| - id: isort | ||
| args: ["--profile", "black", --line-length=100] | ||
| - repo: https://github.com/pycqa/flake8 | ||
| rev: 5.0.4 |
Contributor
Author
There was a problem hiding this comment.
this is the latest version as of today: https://pypi.org/project/flake8/#history
Collaborator
|
Happy with this, merging! |
Contributor
Author
|
thanks @elijahbenizzy ! I think it'll be useful 😊 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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,
flake8is very helpful in detecting correctness and efficiency related issues such as:f-stringsAnd many more.
Changes
"resolves" the following
flake8warnings by annotating them with#noqacomments.Adds the latest version of
flake8as a newpre-committask, ensuring that it's run in CI.Adds a root-level
setup.cfgcontaining configuration forflake8, including excluding some style-only warnings that are currently raised runningflake8 .onmain.Testing
Notes
Why
setup.cfginstead of just adding configuration in.pre-commit-config.yaml?Putting configuration for tools like
flake8into the standard files used in Python projects (e.g.setup.cfgorpyproject.toml) decouples the configuration from the thing running the tool. e.g. if this project were to switch frompre-commit runto aMakefileor shell script for running these checks, none of theflake8configuration 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