Start using Hacking

Blacklist those warnings that occur frequently for
followup patches. Fixup the rest and enable gating
on those.

Change-Id: I79f0ff1c16d9cb7f07cc99382c2a383e2fa532fc
This commit is contained in:
Dirk Mueller 2013-06-25 11:28:47 +02:00
parent 7ab80b554d
commit 0ee399a828
9 changed files with 15 additions and 13 deletions

View File

@ -33,6 +33,6 @@ commands = {posargs}
[flake8]
show-source = True
ignore = E125,F401,F403,F811,F821,F841,H
ignore = E125,F401,F403,F811,F821,F841,H102,H103,H201,H23,H301,H306,H401,H402,H403,H404,H702,H703
builtins = _
exclude=.venv,.tox,dist,doc,openstack,*egg,rsdns,tools

View File

@ -222,7 +222,7 @@ class UserAccessController(wsgi.Controller):
username, hostname = unquote_user_host(user_id)
access = models.User.access(context, instance_id, username, hostname)
databases = [db.name for db in access.databases]
if not id in databases:
if id not in databases:
raise exception.DatabaseNotFound(uuid=id)
models.User.revoke(context, instance_id, username, hostname, id)
return wsgi.Result(None, 202)

View File

@ -105,7 +105,7 @@ class SecurityGroupRuleController(wsgi.Controller):
def _validate_create_body(self, body):
try:
# TODO: Add some better validation here around ports,
# TODO(slicknik): Add some better validation here around ports,
# protocol, and cidr values.
body['security_group_rule']
body['security_group_rule']['group_id']

View File

@ -303,12 +303,12 @@ class MySQLDatabase(Base):
if not value:
pass
elif self._character_set:
if not value in self.charset[self._character_set]:
if value not in self.charset[self._character_set]:
msg = "'%s' not a valid collation for charset '%s'"
raise ValueError(msg % (value, self._character_set))
self._collate = value
else:
if not value in self.collation:
if value not in self.collation:
raise ValueError("'%s' not a valid collation" % value)
self._collate = value
self._character_set = self.collation[value]

View File

@ -1025,8 +1025,8 @@ class DeleteInstance(object):
except backend_exception.VolumeNotFound:
pass
#TODO: make sure that the actual instance, volume, guest status, and DNS
# entries are deleted.
#TODO(tim-simpson): make sure that the actual instance, volume,
# guest status, and DNS entries are deleted.
@test(depends_on=[WaitForGuestInstallationToFinish],

View File

@ -635,7 +635,7 @@ class ResizeInstanceVolume(object):
for database in databases:
db_list.append(database.name)
for name in self.expected_dbs:
if not name in db_list:
if name not in db_list:
fail("Database %s was not found after the volume resize. "
"Returned list: %s" % (name, databases))

View File

@ -106,7 +106,8 @@ def mgmt_instance_get():
instance.has_field('volume', dict, volume_check)
else:
instance.has_field('volume', None)
#TODO: Validate additional fields, assert no extra fields exist.
#TODO(tim-simpson): Validate additional fields, assert
# no extra fields exist.
with CollectionCheck("server", api_instance.server) as server:
server.has_element("addresses", dict)
server.has_element("deleted", bool)
@ -183,7 +184,8 @@ class WhenMgmtInstanceGetIsCalledButServerIsNotReady(object):
# Can be None if no volume is given on this instance.
instance.has_field('server', None)
instance.has_field('volume', None)
#TODO: Validate additional fields, assert no extra fields exist.
#TODO(tim-simpson): Validate additional fields,
# assert no extra fields exist.
@test(depends_on_classes=[CreateInstance], groups=[GROUP])

View File

@ -57,7 +57,7 @@ class ApiTest(testtools.TestCase):
self.assertTrue(self.api._check_for_hearbeat())
def test_check_for_heartbeat_exception(self):
# TODO (juice) maybe it would be ok to extend the test to validate
# TODO(juice): maybe it would be ok to extend the test to validate
# the is_active method on the heartbeat
when(db_models.DatabaseModelBase).find_by(instance_id=any()).thenRaise(
exception.ModelNotFoundError)
@ -68,7 +68,7 @@ class ApiTest(testtools.TestCase):
verify(agent_models.AgentHeartBeat, times=0).is_active(any())
def test_check_for_heartbeat_negative(self):
# TODO (juice) maybe it would be ok to extend the test to validate
# TODO(juice): maybe it would be ok to extend the test to validate
# the is_active method on the heartbeat
when(db_models.DatabaseModelBase).find_by(
instance_id=any()).thenReturn('agent')

View File

@ -144,7 +144,7 @@ class GuestAgentManagerTest(testtools.TestCase):
SEC_COUNT = 1 if is_mysql_installed else 0
migrate_count = 1 * COUNT if not backup_id else 0
# TODO (juice) this should stub an instance of the MySqlAppStatus
# TODO(juice): this should stub an instance of the MySqlAppStatus
mock_status = mock()
when(dbaas.MySqlAppStatus).get().thenReturn(mock_status)
when(mock_status).begin_mysql_install().thenReturn(None)