heat/tools/pyflakes-bypass.py
Steven Dake d640718167 Gate on certain pyflakes failures
To prevent recent gating problems from typos, an
import not used and redefinition of function problems in
the source code have become gating.

Fixes: Bug #1131275
Change-Id: I7011f3ac5940afc70c38758e67a2222a66e625c3
Signed-off-by: Steven Dake <sdake@redhat.com>
2013-02-28 20:21:02 +00:00

16 lines
467 B
Python

from pyflakes.scripts import pyflakes
from pyflakes.checker import Checker
def report_with_bypass(self, messageClass, *args, **kwargs):
text_lineno = args[0] - 1
with open(self.filename, 'r') as code:
if code.readlines()[text_lineno].find('pyflakes_bypass') >= 0:
return
self.messages.append(messageClass(self.filename, *args, **kwargs))
# monkey patch checker to support bypass
Checker.report = report_with_bypass
pyflakes.main()