Pre-commit hook for Git checking Python code quality. The hook will check files ending with
.py or that has a she bang containing
Set the threshold for the quality by updating the
LIMIT value in the
Download the hook (or just copy it from GitHub) and save it in your Git repo as
Don't forget to make it executable.
The commit hook will automatically be called when you are running
git commit. If you want to skip the tests for a certain commit, use the
git commit -n.
Setting score limit
pre-commit script and update the
LIMIT value according to your needs. E.g.
LIMIT = 8.0
pylint command line options
The hook supports custom command line options to be specified. Those can be added to the
PYLINT_PARAMS inside the
pre-commit script. E.g.
PYLINT_PARAMS = '--rcfile=/path/to/project/pylint.rc'
This commit hook is written in Python and has the following requirements:
- pylint (
sudo pip install pylint)
- Python >2.5 and <3.0
- Added support for negative pylint scores #4
- Added support for custom command line params to pylint #6
- Fixed bug #3 Empty .py files fails according to pylint
- Fixed bug #1 Files parsed number is not increased
- Fixed bug with non-python files getting checked, if they contained
pythonon the first row
- Added support for handling moved or deleted files
- Initial release of the commit hook