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:
Steven Dake 2013-02-27 15:23:48 -07:00 committed by Gerrit Code Review
parent 2358f6d5bc
commit d640718167
7 changed files with 25 additions and 6 deletions

View File

@ -28,7 +28,7 @@ from heat.common import exception
from heat.common import identifier
from heat.engine import parser
from heat.engine import resource
from heat.engine import resources
from heat.engine import resources # pyflakes_bypass review 23102
from heat.engine import watchrule
from heat.openstack.common import log as logging

View File

@ -28,9 +28,9 @@ def reset_db():
def setup():
import mox # Fail fast if you don't have mox. Workaround for bug 810424
import mox # pyflakes_bypass Workaround for bug 810424
from heat.db import migration
from heat import db
from heat import db # pyflakes_bypass review 23102
reset_db()
migration.db_sync()

View File

@ -20,7 +20,8 @@ from nose.plugins.attrib import attr
from oslo.config import cfg
import unittest
import heat.api
import heat.api # pyflakes_bypass review 23102
from heat.common import context
from heat.common import policy
from heat.common import exception

View File

@ -22,7 +22,7 @@ from heat.engine import clients
from heat.common import context
from heat.common import template_format
from heat.engine import parser
import heat.engine.resources
import heat.engine.resources # pyflakes_bypass review 23102
from heat.tests.v1_1 import fakes
from novaclient.v1_1 import security_groups as nova_sg

View File

@ -22,7 +22,7 @@ from heat.common import context
from heat.common import exception
from heat.common import template_format
from heat.engine import parser
import heat.engine.resources
import heat.engine.resources # pyflakes_bypass review 23102
try:
from quantumclient.common.exceptions import QuantumClientException

15
tools/pyflakes-bypass.py Normal file
View 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()

View File

@ -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"