Confirmed users
2,204
edits
(Created page with "= Introduction = The style guide specifies that all Python code adheres to [http://www.python.org/dev/peps/pep-0008/ PE...") |
No edit summary |
||
| Line 18: | Line 18: | ||
flake8 --install-hook | flake8 --install-hook | ||
== Git Template == | |||
You can add this hook to the git template, which means it will be active for all freshly initialised git repositories (unless they already contain a pre-commit hook). | |||
cd ~/workspace/mygitrepo | |||
git config --global init.templatedir ~/.git_template | |||
mkdir ~/.git_template/hooks | |||
cp .git/hooks/pre-commit ~/.git_template/hooks/ | |||
= Usage = | = Usage = | ||
| Line 34: | Line 42: | ||
Note that by default the warnings are displayed but the commit is still allowed. | Note that by default the warnings are displayed but the commit is still allowed. | ||
== Running the Hook == | |||
To run the hook directly instead of attempting a commit: | |||
./.git/hooks/pre-commit | |||
== Preventing Commits == | == Preventing Commits == | ||
| Line 39: | Line 52: | ||
export FLAKE8_STRICT=true | export FLAKE8_STRICT=true | ||
You may want to add this to your default profile. | |||
== Ignoring Warnings == | == Ignoring Warnings == | ||
To ignore certain warnings: | To ignore certain warnings: | ||
export FLAKE8_IGNORE=E501 | export FLAKE8_IGNORE=E501 | ||
You may want to add this to your default profile. | |||