Skip to content
This repository has been archived by the owner on Mar 7, 2021. It is now read-only.

tag things with '# pyflakes.ignore' #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion pyflakes/scripts/pyflakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,21 @@ def check(codeString, filename):
# Okay, it's syntactically valid. Now check it.
w = checker.Checker(tree, filename)
w.messages.sort(lambda a, b: cmp(a.lineno, b.lineno))
warnings = 0
for warning in w.messages:
if skip_warning(warning):
continue
print warning
return len(w.messages)
warnings += 1
return warnings

def skip_warning(warning):
# quick dirty hack, just need to keep the line in the warning
line = open(warning.filename).readlines()[warning.lineno-1]
return skip_line(line)

def skip_line(line):
return line.rstrip().endswith('# pyflakes.ignore')

def checkPath(filename):
"""
Expand Down