1. mccabe.py support # NOQA 2. run.py support ignore some errors 3. run.py add max_line_length default value

This commit is contained in:
onlytiancai 2012-09-12 11:03:20 +08:00
parent dd92d52f06
commit ccc7acc62e
3 changed files with 17 additions and 10 deletions

View file

@ -119,6 +119,7 @@ def _initpep8():
pep8.options.logical_checks = pep8.find_checks('logical_line')
pep8.options.counters = dict.fromkeys(pep8.BENCHMARK_KEYS, 0)
pep8.options.messages = {}
pep8.options.max_line_length = 79
pep8.args = []
@ -129,8 +130,11 @@ def run(command):
[line.strip() for line in p.stderr.readlines()])
def git_hook(complexity=-1, strict=False):
def git_hook(complexity=-1, strict=False, ignore=None):
_initpep8()
if ignore:
pep8.options.ignore=ignore
warnings = 0
_, files_modified, _ = run("git diff-index --cached --name-only HEAD")