Add pre-commit to run in the GitHub Workflow on each push and PR update:
Many Python packages use the pre-commit Python Framework for sanity checks when updating Python projects.
Additionally, you can run it locally for faster fixing of issues using:
$ pip3 install pre-commit
$ pre-commit run
The most popular checks are:
Don't commit to the master branch (only commit to private branches)
Fix not adding trailing spaces to commits
Fix terminating files with one trailing newline(and not more)
Fix using conistent LF for line-endings, not a mix with CR/LF.
Remove unused variables and unused imports and sort imports
Apply consistent code formatting for the project (using black)
Check that debug statements are not accitendially merged
Check that executables have shebangs and scripts are exectuable
Check that merge conflicts are properly resolved
Check YAML syntax
Those can also be helpful and for small project, they are fast:
Run quick tests
Run mypy to e.g. check that expected function arguments are passed
Run pylint to check that developers added docstrings, etc
Add these checks to GitHub CI and fix the issues which needed fixing, like missing docstrings.
Developers can also elect to run checks locally during development See the header of the config file .pre-commit-config.yaml for details how to install it locally.
Add pre-commit to run in the GitHub Workflow on each push and PR update:
Many Python packages use the
pre-commit
Python Framework for sanity checks when updating Python projects.Additionally, you can run it locally for faster fixing of issues using:
The most popular checks are:
Those can also be helpful and for small project, they are fast:
Add these checks to GitHub CI and fix the issues which needed fixing, like missing docstrings.
Developers can also elect to run checks locally during development See the header of the config file
.pre-commit-config.yaml
for details how to install it locally.