-
Notifications
You must be signed in to change notification settings - Fork 194
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
Adding pre-commit #338
base: main
Are you sure you want to change the base?
Adding pre-commit #338
Conversation
Introduced changes: - pre-commit config and rules - Flake8 is covered in the pre-commit hooks. - Applying fixes for pre-commit compliance in all code. Also it is worth to note that commit hash will be used instead of version tags in pre-commit to prevend arbitrary code from running in developer's machines. pre-commit will be used to: - trailing whitespace; - Replaces or checks mixed line ending (mixed-line-ending); - Forbid files which have a UTF-8 byte-order marker (check-byte-order-marker); - Checks that non-binary executables have a proper shebang (check-executables-have-shebangs); - Check for files that contain merge conflict strings (check-merge-conflict); - Check for debugger imports and py37+ breakpoint() calls in python source (debug-statements); - Attempts to load all yaml files to verify syntax (check-yaml); - Run flake8 checks (flake8) (local) For further details about tests please refer to: https://github.com/pre-commit/pre-commit-hooks
Thank you. I'll review this after I finish releasing Celery 5. |
@thedrow thanks |
Hello @thedrow, An update about these changes? |
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 only the merge conflicts should be fixed here
- id: debug-statements | ||
- id: check-yaml | ||
files: .*\.(yaml|yml)$ | ||
- repo: https://gitlab.com/pycqa/flake8 |
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.
isn't it available in github as well?
The rationale behind these changes is to catch linter errors (pep8) automatically before developers submit their changes and pull-requests.
These changes will help us become proactive with the apply of our coding rules (pep8, etc...) and avoid back and forth with patches and reviews.
In other words these changes could help us to reduce our CI usages and possibly also help us to reduce the amount (of pending) reviews by catching early issues on the developer side.
Note that pre-commit is optional and people who don't want to use it don't need to do something.
With these changes
tox
is plugged onpre-commit
to run flake8 checks, this approach allow us to centralize things and avoid to duplicate how this kind of test is executed.Introduced changes:
Also it is worth to note that commit hash will be used instead of version tags
in pre-commit to prevend arbitrary code from running in developer's machines.
pre-commit will be used to:
shebang (check-executables-have-shebangs);
calls in python source (debug-statements);
Also these changes can be used automatically by using:
With the previous commands checks will be passed at each commit by using git-hooks' mechanisms.
For further details about tests please refer to: https://github.com/pre-commit/pre-commit-hooks
Also note that the changes on
docs/make.bat
are simply file permissions to render this file as an executable file.