Use the flake8 tool on the master branch

This commit is contained in:
Stephane Wirtel 2010-08-12 17:07:03 +02:00
parent 4f6d1eb6cc
commit ed429af48c
9 changed files with 91 additions and 132 deletions

View file

@ -10,6 +10,7 @@ import pep8
checker = __import__('flake8.checker').checker
def check(codeString, filename):
"""
Check the Python source given by C{codeString} for flakes.
@ -65,11 +66,13 @@ def check(codeString, filename):
return valid_warnings
def _noqa(warning):
# XXX quick dirty hack, just need to keep the line in the warning
line = open(warning.filename).readlines()[warning.lineno-1]
line = open(warning.filename).readlines()[warning.lineno - 1]
return line.strip().lower().endswith('# noqa')
def checkPath(filename):
"""
Check the given path, printing out any warnings detected.
@ -105,5 +108,4 @@ def main():
stdin = sys.stdin.read()
warnings += check(stdin, '<stdin>')
raise SystemExit(warnings > 0)