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>
This commit is contained in:
committed by
Gerrit Code Review
parent
2358f6d5bc
commit
d640718167
15
tools/pyflakes-bypass.py
Normal file
15
tools/pyflakes-bypass.py
Normal file
@@ -0,0 +1,15 @@
|
||||
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()
|
||||
@@ -15,3 +15,6 @@ ${PEP8} ${EXCLUDE} .
|
||||
|
||||
# Check binaries without py extension
|
||||
${PEP8} bin/heat-api bin/heat-api-cfn bin/heat-api-cloudwatch bin/heat-cfn bin/heat-engine bin/heat-watch
|
||||
|
||||
! python tools/pyflakes-bypass.py heat/ | grep "imported but unused\|redefinition of function"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user