Skip to content

Git pre-commit hook to check Python code quality with pylint. You can use this hook to prohibit Python code with a bad syntax to be checked in.

Notifications You must be signed in to change notification settings

Zearin/git-pylint-commit-hook

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 

Repository files navigation

git-pylint-commit-hook

Pre-commit hook for Git checking Python code quality. The hook will check files ending with .py or that has a she bang containing python.

Set the threshold for the quality by updating the LIMIT value in the pre-commit hook.

Installation

Download the hook (or just copy it from GitHub) and save it in your Git repo as .git/hooks/pre-commit.

Don't forget to make it executable.

Usage

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 -n flag, git commit -n.

Setting score limit

Open the pre-commit script and update the LIMIT value according to your needs. E.g.

LIMIT = 8.0

Custom 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'

Requirements

This commit hook is written in Python and has the following requirements:

  • pylint (sudo pip install pylint)
  • Python >2.5 and <3.0

Release notes

0.8 (2013-01-09)

0.7 (2012-12-07)

  • Bug when skipping init.py files fixed. Wrong path was checked under some circumstanses

0.6 (2012-12-04)

0.5 (2012-12-01)

0.4 (2012-11-30)

0.3 (2012-11-18)

  • Fixed bug with non-python files getting checked, if they contained python on the first row

0.2 (2012-11-16)

  • Added support for handling moved or deleted files

0.1 (2012-11-09)

  • Initial release of the commit hook

About

Git pre-commit hook to check Python code quality with pylint. You can use this hook to prohibit Python code with a bad syntax to be checked in.

Resources

Stars

Watchers

Forks

Packages

No packages published