mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-16 17:19:52 +00:00
Update the VCS docs
Also, update the git_hook auto-installer text. Fixes #87 on BitBucket
This commit is contained in:
parent
ea1c29ca2e
commit
9844142528
2 changed files with 9 additions and 3 deletions
|
|
@ -8,8 +8,8 @@ To use the Mercurial hook on any *commit* or *qrefresh*, change your .hg/hgrc
|
||||||
file like this::
|
file like this::
|
||||||
|
|
||||||
[hooks]
|
[hooks]
|
||||||
commit = python:flake8.run.hg_hook
|
commit = python:flake8.hooks.hg_hook
|
||||||
qrefresh = python:flake8.run.hg_hook
|
qrefresh = python:flake8.hooks.hg_hook
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
strict = 0
|
strict = 0
|
||||||
|
|
@ -32,13 +32,16 @@ To use the Git hook on any *commit*, add a **pre-commit** file in the
|
||||||
|
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import sys
|
import sys
|
||||||
from flake8.run import git_hook
|
from flake8.hooks import git_hook
|
||||||
|
|
||||||
COMPLEXITY = 10
|
COMPLEXITY = 10
|
||||||
STRICT = False
|
STRICT = False
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sys.exit(git_hook(complexity=COMPLEXITY, strict=STRICT, ignore='E501'))
|
sys.exit(git_hook(complexity=COMPLEXITY, strict=STRICT, ignore='E501'))
|
||||||
|
# Alternatively
|
||||||
|
# sys.exit(git_hook(complexity=COMPLEXITY, strict=STRICT,
|
||||||
|
# ignore=['E501']))
|
||||||
|
|
||||||
|
|
||||||
If *strict* option is set to **True**, any warning will block the commit. When
|
If *strict* option is set to **True**, any warning will block the commit. When
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,9 @@ def git_hook(complexity=-1, strict=False, ignore=None, lazy=False):
|
||||||
if lazy:
|
if lazy:
|
||||||
gitcmd = gitcmd.replace('--cached ', '')
|
gitcmd = gitcmd.replace('--cached ', '')
|
||||||
|
|
||||||
|
if hasattr(ignore, 'split'):
|
||||||
|
ignore = ignore.split(',')
|
||||||
|
|
||||||
_, files_modified, _ = run(gitcmd)
|
_, files_modified, _ = run(gitcmd)
|
||||||
|
|
||||||
flake8_style = get_style_guide(
|
flake8_style = get_style_guide(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue