Fixes new hacking rules

Updated the hacking version as per global-requirements.

Fixed some of new appearing hacking rules, as listed follows:
- E128 continuation line under-indented for visual indent
- E265 block comment should start with '# '
- E713 test for membership should be 'not in'
- H238  old style class declaration, use new style (inherit from `object`)

Rules which are not yet fixed have been incorporated to ignorelist
- H405 Multi line docstrings should start with a one line summary
       followed by an empty line
- H501 Do not use locals() or self.__dict__ for formatting strings

Change-Id: I885c6fa8ad0e6a98f7a8479f3441ed08ed2cbaa6
This commit is contained in:
Sushil Kumar 2015-05-20 20:13:02 +00:00
parent 82e05cb13a
commit 025191af50
7 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,7 @@
# The order of packages is significant, because pip processes them in the order # The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
hacking>=0.8.0,<0.9 hacking>=0.10.0,<0.11
coverage>=3.6 coverage>=3.6
discover discover
oslosphinx>=2.5.0 # Apache-2.0 oslosphinx>=2.5.0 # Apache-2.0

View File

@ -37,6 +37,6 @@ commands =
python setup.py build_sphinx python setup.py build_sphinx
[flake8] [flake8]
ignore = H202 ignore = H202,H405,H501
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

@ -40,7 +40,7 @@ class CommonTest(testtools.TestCase):
sys.exit = self.orig_sys_exit sys.exit = self.orig_sys_exit
def test_methods_of(self): def test_methods_of(self):
class DummyClass: class DummyClass(object):
def dummyMethod(self): def dummyMethod(self):
print("just for test") print("just for test")

View File

@ -456,7 +456,7 @@ class Resource(object):
def __getattr__(self, k): def __getattr__(self, k):
if k not in self.__dict__: if k not in self.__dict__:
#NOTE(bcwaldon): disallow lazy-loading if already loaded once # NOTE(bcwaldon): disallow lazy-loading if already loaded once
if not self.is_loaded: if not self.is_loaded:
self._get() self._get()
return self.__getattr__(k) return self.__getattr__(k)

View File

@ -79,7 +79,7 @@ class FakeHTTPClient(client.HTTPClient):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.callstack = [] self.callstack = []
self.fixtures = kwargs.pop("fixtures", None) or {} self.fixtures = kwargs.pop("fixtures", None) or {}
if not args and not "auth_plugin" in kwargs: if not args and "auth_plugin" not in kwargs:
args = (None, ) args = (None, )
super(FakeHTTPClient, self).__init__(*args, **kwargs) super(FakeHTTPClient, self).__init__(*args, **kwargs)

View File

@ -436,9 +436,9 @@ class OpenStackTroveShell(object):
# V3 stuff # V3 stuff
project_info_provided = (self.options.os_tenant_name or project_info_provided = (self.options.os_tenant_name or
self.options.os_tenant_id or self.options.os_tenant_id or
(self.options.os_project_name and (self.options.os_project_name and
(self.options.os_project_domain_name or (self.options.os_project_domain_name or
self.options.os_project_domain_id)) or self.options.os_project_domain_id)) or
self.options.os_project_id) self.options.os_project_id)
if (not project_info_provided): if (not project_info_provided):

View File

@ -41,7 +41,7 @@ class Flavors(base.ManagerWithFind):
:rtype: list of :class:`Flavor`. :rtype: list of :class:`Flavor`.
""" """
return self._list("/datastores/%s/versions/%s/flavors" % return self._list("/datastores/%s/versions/%s/flavors" %
(datastore, version_id), (datastore, version_id),
"flavors") "flavors")
def get(self, flavor): def get(self, flavor):