Skip to content

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

Notifications You must be signed in to change notification settings

keitaroinc/pep8-git-hook

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 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 pycodestyle (formally called pep8) program: $ pip install pycodestyle
  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

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. Additional arguments to the pycodestyle program (e.g., --max-line-length=120) can be added to the overrides list.

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

About

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

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%