-
-
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,39 @@ | ||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
repos: | ||
- repo: https://github.com/python/black | ||
rev: 21.9b0 | ||
hooks: | ||
- id: black | ||
|
||
- repo: https://github.com/sqlalchemyorg/zimports | ||
rev: v0.4.1 | ||
hooks: | ||
- id: zimports | ||
|
||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.2.3 | ||
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 commentThe reason will be displayed to describe this comment to others. Learn more. not sure it's really needed. we use test for this |
||
- id: check-symlinks | ||
- id: trailing-whitespace | ||
- id: check-json | ||
- id: debug-statements | ||
- id: pretty-format-json | ||
args: ["--autofix", "--allow-missing-credentials"] | ||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.6.4 | ||
hooks: | ||
- id: isort | ||
args: ["--profile", "black"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we use zimports so -1 here |
||
- repo: https://gitlab.com/pycqa/flake8 | ||
rev: "8f9b4931b9a28896fb43edccb23016a7540f5b82" | ||
hooks: | ||
- id: flake8 | ||
additional_dependencies: [flake8-print] | ||
files: '\.py$' | ||
exclude: docs/ | ||
args: | ||
- --select=F403,F406,F821,T003 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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. |
||
- repo: https://github.com/humitos/mirrors-autoflake | ||
rev: v1.3 | ||
hooks: | ||
- id: autoflake | ||
files: '\.py$' | ||
exclude: '^\..*' | ||
args: ["--in-place"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this seems to run |
||
- repo: https://github.com/psf/black | ||
rev: 19.10b0 | ||
hooks: | ||
- id: black | ||
args: ["--target-version", "py37"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
[build-system] | ||
build-backend = 'setuptools.build_meta' | ||
requires = ['setuptools >= 47', 'wheel'] | ||
|
||
[tool.black] | ||
line-length = 79 | ||
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.
this removes the test run, so maybe we can have this together with the current version