QA/Execution/Web Testing/Automation/PEP8 Pre Commit Hook
< QA | Execution | Web Testing | Automation
Jump to navigation
Jump to search
PEP8 Pre-Commit Hook
The style guide specifies that all Python code adheres to PEP8. To prevent committing code that does not pass PEP8, follow these steps to installing a pre-commit to run staged files using the pep8 checker.
Install pep8:
pip install pep8
Set the git global templates directory:
git config --global init.templatedir /usr/local/git/share/git-core/templates
Clone the pre-commit hook and move it to the templates directory:
git clone git://gist.github.com/3560385.git sudo mv 3560385/pre-commit /usr/local/git/share/git-core/templates/hooks rm -rf 3560385
Ensure that the pre-commit hook file is marked as executable:
chmod +x /usr/local/git/share/git-core/templates/hooks/pre-commit
Reinitialize any existing git repositories:
git init