-
Notifications
You must be signed in to change notification settings - Fork 9
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
Pre-commit workflow #21
Conversation
Signed-off-by: Lee, Kin Long Kelvin <[email protected]>
Since `setup.py` doesn't have a good mechanism for differentiating between production and development dependencies, including this file as a way for contributors Signed-off-by: Lee, Kin Long Kelvin <[email protected]>
Signed-off-by: Lee, Kin Long Kelvin <[email protected]>
Signed-off-by: Lee, Kin Long Kelvin <[email protected]>
Signed-off-by: Lee, Kin Long Kelvin <[email protected]>
Some further improvements could be had, if we want to segment into specific |
Signed-off-by: Lee, Kin Long Kelvin <[email protected]>
Signed-off-by: Lee, Kin Long Kelvin <[email protected]>
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.
CONTRIBUTING.md still refers to pylint and the old hooks. Would you mind reviewing that and updating the text to reflect the changes here?
Signed-off-by: Kin Long Kelvin Lee <[email protected]>
Signed-off-by: Kin Long Kelvin Lee <[email protected]>
Done in 24728d0. I'll update again with |
This is good, but I think there are some more parts to change. There are a few references to I think we should remove the pre-commit and post-commit bullets from the "Hooks" section, and remove the reference to |
|
I'm not sure. For the P3 Analysis Library we apparently set it to 79: Maybe we should just go to 79? It would make it easier to share code between the two projects, which is quite likely. |
79 is PEP8, we can do that sure |
Signed-off-by: Kin Long Kelvin Lee <[email protected]>
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.
Changes look good. As discussed offline, I don't think we should actually run these hooks until the next release, but I've tested things locally and everything seems to work.
This PR adds a configuration file for
pre-commit
as the preferred mechanism for maintaininggit
hooks, replacing thesetup_git_hooks.sh
and relatedpre-commit
andpost-commit
execution scripts.The configuration adds more to the
git commit
workflow, with some replacements:Additions
Style/formatting
Style and formatting changes enforce best practices tied to Python 3.9+
23.7.0
Linting
We replace
pylint
withflake8
, which also includes additional plugins such asflake8-bandit
andflake8-black
for example.Security
Adds
bandit
as part of the workflow which will identify security vulnerabilities with committed code.Replacements
pylint
is replaced byflake8
autopep8
is replaced byblack
Removal
unittest
was removed for now.pre-commit
doesn't have a supported workflow and we could write one ourselves. It might also be a bit extreme to have unit tests run every single commit, and we may want to just have that as CI instead. We can do a follow up PR.Partially addresses #18 by replacing
pylint
withflake8
as configured in.pre-commit-config.yaml