-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
Use pre-commit
as linter & Checker ✨
#345
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm personally -1 on some of these.
In particular I prefer to keep the configuration out of .pre-commit so that one is free to use the same tools with other runners.
python -m pip install pre-commit | ||
- name: Test Project linting | ||
run: | | ||
pre-commit run --all-files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this removes the test run, so maybe we can have this together with the current version
rev: 5.6.4 | ||
hooks: | ||
- id: isort | ||
args: ["--profile", "black"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use zimports so -1 here
files: '\.py$' | ||
exclude: docs/ | ||
args: | ||
- --select=F403,F406,F821,T003 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes more sense to keep the configuration in setup.cfg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also tox is probably a better place for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to @CaselIT's suggestion on this. I generally like the idea of linting/checking on a pre-commit hook, but those checks will often need to be run on-demand during development -- and configuring them within pre-commit would require them to be duplicated in other config files.
- id: autoflake | ||
files: '\.py$' | ||
exclude: '^\..*' | ||
args: ["--in-place"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems to run autoflake
. zimports does mostly the same
rev: 19.10b0 | ||
hooks: | ||
- id: black | ||
args: ["--target-version", "py37"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please keep the current version. also the setting should be in pyproject.toml
hooks: | ||
- id: check-merge-conflict | ||
- id: check-added-large-files | ||
- id: check-ast |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure it's really needed. we use test for this
Thanks for the work. I've left a review. It's probably best to wait for @zzzeek on this also so a single set of changes can be done |
Thanks for the contribution. As @CaselIT and @jvanasco mentioned above, this PR gives |
Hey there -- closing this for now. Let me know if you want to take it back up. |
Based on this issue #344, I was thinking about why not use
.pre-commit
as a linter and checker.Easy way to check code and fix any issue related to code style and code linting, about the rules I use only simple and most used rules for linting, SQLalchemy's team is free to change the rules or use another one for linting.
Note: This is just a simple enhancement to repository structure.