Tighten flake8 checks in Gating

There are a few checks that already pass:
 - F401 - unused imports of modules
 - F403 - ‘from module import *’ used; unable to detect undefined names

And there are two (H401 and H403) that can be made
passing easily. Enable gating on all of them.

Change-Id: I9d3c49ecea1b2171d194ab6cc751316c252081e8
This commit is contained in:
Dirk Mueller
2013-12-14 12:12:43 +01:00
parent 30587ea448
commit d4a62491e1
7 changed files with 22 additions and 15 deletions

View File

@@ -36,7 +36,6 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
sphinx-build -b html {toxinidir}/docs/source {envtmpdir}/html sphinx-build -b html {toxinidir}/docs/source {envtmpdir}/html
[flake8] [flake8]
ignore = F821,H202,H306,H402,H404
ignore = F401,F403,F821,H202,H306,H401,H402,H403,H404
show-source = True show-source = True
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build, exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,

View File

@@ -48,8 +48,9 @@ def quote_user_host(user, host):
class Paginated(object): class Paginated(object):
""" Pretends to be a list if you iterate over it, but also keeps a """Pretends to be a list if you iterate over it, but also keeps a
next property you can use to get the next page of data. """ next property you can use to get the next page of data.
"""
def __init__(self, items=[], next_marker=None, links=[]): def __init__(self, items=[], next_marker=None, links=[]):
self.items = items self.items = items

View File

@@ -202,7 +202,8 @@ class UserCommands(common.AuthedCommandsBase):
def grant(self): def grant(self):
"""Allow an existing user permissions to access one or more """Allow an existing user permissions to access one or more
databases.""" databases.
"""
self._require('id', 'name', 'databases') self._require('id', 'name', 'databases')
self._make_list('databases') self._make_list('databases')
self.dbaas.users.grant(self.id, self.name, self.databases, self.dbaas.users.grant(self.id, self.name, self.databases,

View File

@@ -29,7 +29,8 @@ from troveclient.openstack.common.py3kcompat import urlutils
def methods_of(obj): def methods_of(obj):
"""Get all callable methods of an object that don't start with underscore """Get all callable methods of an object that don't start with underscore
returns a list of tuples of the form (method_name, method)""" returns a list of tuples of the form (method_name, method).
"""
result = {} result = {}
for i in dir(obj): for i in dir(obj):
if callable(getattr(obj, i)) and not i.startswith('_'): if callable(getattr(obj, i)) and not i.startswith('_'):
@@ -82,7 +83,8 @@ def quote_user_host(user, host):
class CliOptions(object): class CliOptions(object):
"""A token object containing the user, apikey and token which """A token object containing the user, apikey and token which
is pickleable.""" is pickleable.
"""
APITOKEN = os.path.expanduser("~/.apitoken") APITOKEN = os.path.expanduser("~/.apitoken")
@@ -400,8 +402,9 @@ class AuthedCommandsBase(CommandsBase):
class Paginated(object): class Paginated(object):
""" Pretends to be a list if you iterate over it, but also keeps a """Pretends to be a list if you iterate over it, but also keeps a
next property you can use to get the next page of data. """ next property you can use to get the next page of data.
"""
def __init__(self, items=[], next_marker=None, links=[]): def __init__(self, items=[], next_marker=None, links=[]):
self.items = items self.items = items

View File

@@ -15,7 +15,8 @@
class UnsupportedVersion(Exception): class UnsupportedVersion(Exception):
"""Indicates that the user is trying to use an unsupported """Indicates that the user is trying to use an unsupported
version of the API""" version of the API.
"""
pass pass
@@ -33,7 +34,8 @@ class NoUniqueMatch(Exception):
class NoTokenLookupException(Exception): class NoTokenLookupException(Exception):
"""This form of authentication does not support looking up """This form of authentication does not support looking up
endpoints from an existing token.""" endpoints from an existing token.
"""
pass pass

View File

@@ -20,7 +20,8 @@
class UnsupportedVersion(Exception): class UnsupportedVersion(Exception):
"""Indicates that the user is trying to use an unsupported """Indicates that the user is trying to use an unsupported
version of the API""" version of the API.
"""
pass pass
@@ -38,7 +39,8 @@ class NoUniqueMatch(Exception):
class NoTokenLookupException(Exception): class NoTokenLookupException(Exception):
"""This form of authentication does not support looking up """This form of authentication does not support looking up
endpoints from an existing token.""" endpoints from an existing token.
"""
pass pass

View File

@@ -38,8 +38,7 @@ class Root(base.ManagerWithFind):
return body['user']['name'], body['user']['password'] return body['user']['name'], body['user']['password']
def is_root_enabled(self, instance_id): def is_root_enabled(self, instance_id):
""" Return True if root is enabled for the instance; """Return whether root is enabled for the instance."""
False otherwise"""
resp, body = self.api.client.get(self.url % instance_id) resp, body = self.api.client.get(self.url % instance_id)
common.check_for_exceptions(resp, body) common.check_for_exceptions(resp, body)
return self.resource_class(self, body, loaded=True) return self.resource_class(self, body, loaded=True)