Skip to content

Git pre-commit hook that checks for Python PEP8 style compliance.

Notifications You must be signed in to change notification settings

xiekuncn/pep8-git-hook

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

PEP8 Git Commit Hook

This is a pre-commit hook for Git that checks the code to be committed for Python PEP8 style compliance. The hook will prevent the commit in case style violations are detected.

Installation:

  1. Install the pep8 program: $ pip install pep8
  2. Save pre-commit as your_project/.git/hooks/pre-commit
  3. Mark pre-commit executable: $ chmod +x your_project/.git/hooks/pre-commit

The hook can be overridden: $ git commit --no-verify

Currently, the following PEP8 codes are ignored for:

E501 line too long (82 > 79 characters) E402 E402 module level import not at top of file E731 do not assign a lambda expression, use a def

In case you want to modify the list of codes to ignore, edit the ignore_codes list in the pre-commit file.
If you want to select only specific codes to scan for, use the select_codes list.

This code was forked from https://gist.github.com/810399.

About

Git pre-commit hook that checks for Python PEP8 style compliance.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%