mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-08 05:54:17 +00:00
Use the flake8 tool on the master branch
This commit is contained in:
parent
4f6d1eb6cc
commit
ed429af48c
9 changed files with 91 additions and 132 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue