-
-
Notifications
You must be signed in to change notification settings - Fork 46k
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 plugins in pre-commit #7127
Comments
Maybe docstrings? https://github.com/PyCQA?q=flake8- But I am sure a ton of existing files do not have docstrings. Also like flake8-2020, flake8-bugbear, flake8-comprehensions, flake8-return, flake8-simplify but... we need to be careful not to go overboard and make contributors too angry to fix all the nits. |
Personally I would go for |
Simplify and comprehensions come up with some quite useful suggestions. Return is helpful for beginners but they have a few errors that I do not agree with. |
Can I make a pull request implementing |
* ci(pre-commit): Add ``flake8-builtins`` additional dependency to ``pre-commit`` (#7104) * refactor: Fix ``flake8-builtins`` (#7104) * fix(lru_cache): Fix naming conventions in docstrings (#7104) * ci(pre-commit): Order additional dependencies alphabetically (#7104) * fix(lfu_cache): Correct function name in docstring (#7104) * Update strings/snake_case_to_camel_pascal_case.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update data_structures/stacks/next_greater_element.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update digital_image_processing/index_calculation.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update graphs/prim.py Co-authored-by: Christian Clauss <cclauss@me.com> * Update hashes/djb2.py Co-authored-by: Christian Clauss <cclauss@me.com> * refactor: Rename `_builtin` to `builtin_` ( #7104) * fix: Rename all instances (#7104) * refactor: Update variable names (#7104) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * ci: Create ``tox.ini`` and ignore ``A003`` (#7123) * revert: Remove function name changes (#7104) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Rename tox.ini to .flake8 * Update data_structures/heap/heap.py Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com> * refactor: Rename `next_` to `next_item` (#7104) * ci(pre-commit): Add `flake8` plugin `flake8-bugbear` (#7127) * refactor: Follow `flake8-bugbear` plugin (#7127) * fix: Correct `knapsack` code (#7127) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
Plugins that are useful for me are:
My personal list is quite huge, but I find it too strict for the project with many contributors. The thing I learned is that things are constantly broken because of library updates, so I prefer to use fixed versions. If you wold like, I could contribute adding this plugins. |
To run flake8 with plugins you need to install them first. Since flake8 is already included in
|
For this repo, I would say no to both eradicate and pytest style.
|
Most of our contributors are first-time-contributors and almost none of them have pre-commit installed and running locally which is why we run pre-commit.ci but a pull request to fix README.md would be welcome. |
flake8-use-pathlib sounds awesome (although I have never seen it in action). |
Flake is pretty flexible with ignoring files with specific errors. I use this plugin for my code and exclude test files from it.
|
A ton means a ton -- take a scroll. |
I have some concerns about it. This code looks super unusual to me. with Path(filename).open() as f:
I could extract errors from the flake8 output and just build a flake8 setting from it. So the new contributions will have docstrings. |
OK. I will try out If you want to do a PR on docstrings, that would be reviewed. Thx. |
Sample PR on how the code should look to conform the flake8-docstrings. #7821 It would be nice to understand the check that we plan to keep and which one we could ignore. Fixing all of them sounds boring. We could either ignore them or keep checking only for new files. |
I'd say it is closed a bit too earlier. I haven't submitted the PR with annotation-docstring yet. I am planning to do it today in the evening, so no need to reopen it. I have learned a lot of cool things from yours pre-commit hooks, things like yesqa are exactly what I need in my projects. |
I need to try to review the 150+ current open PRs so please hold off on adding more PRs until Tuesday, Nov 1st. |
I have a free evening today, could I help with the review? |
Feature description
Certain flake8 plugins increase code quality.
Two of these plugins have been implemented so far,
pep8-naming
andflake8-builtins
.What other plugins should be implemented?
Would you like to work on this feature?
The text was updated successfully, but these errors were encountered: