From 71fad66213ee3fd7e2ba24c055f4915ab40f20e5 Mon Sep 17 00:00:00 2001 From: Joe Gordon Date: Tue, 24 Mar 2015 19:15:19 -0400 Subject: [PATCH] Move to hacking 0.10 Release notes: http://lists.openstack.org/pipermail/openstack-dev/2015-January/054165.html Ignore some new rules that have more then 10 failures, fix ones that have fewer. Removed deleted hacking rules from tox.ini Note: One of the main benefits of the new hacking, is flake8 enables concurrency by default now, so it should be much faster. Change-Id: Ie650fa3dc91434967ad05e61edd3bcc1d833bfb1 --- cinder/api/v1/limits.py | 8 +++++--- cinder/api/v2/limits.py | 8 +++++--- .../tests/scheduler/test_goodness_weigher.py | 2 +- cinder/tests/test_hacking.py | 2 +- cinder/volume/drivers/prophetstor/dpl_iscsi.py | 2 +- test-requirements.txt | 3 ++- tox.ini | 18 +++++++----------- 7 files changed, 22 insertions(+), 21 deletions(-) diff --git a/cinder/api/v1/limits.py b/cinder/api/v1/limits.py index f521d9055..eca339eb8 100644 --- a/cinder/api/v1/limits.py +++ b/cinder/api/v1/limits.py @@ -136,9 +136,11 @@ class Limit(object): self.water_level = 0 self.capacity = self.unit self.request_value = float(self.capacity) / float(self.value) - msg = _("Only %(value)s %(verb)s request(s) can be " - "made to %(uri)s every %(unit_string)s.") - self.error_message = msg % self.__dict__ + msg = (_("Only %(value)s %(verb)s request(s) can be " + "made to %(uri)s every %(unit_string)s.") % + {'value': self.value, 'verb': self.verb, + 'uri': self.uri, 'unit_string': self.unit_string}) + self.error_message = msg def __call__(self, verb, url): """Represent a call to this limit from a relevant request. diff --git a/cinder/api/v2/limits.py b/cinder/api/v2/limits.py index abad4b9e4..a75f39bbc 100644 --- a/cinder/api/v2/limits.py +++ b/cinder/api/v2/limits.py @@ -136,9 +136,11 @@ class Limit(object): self.water_level = 0 self.capacity = self.unit self.request_value = float(self.capacity) / float(self.value) - msg = _("Only %(value)s %(verb)s request(s) can be " - "made to %(uri)s every %(unit_string)s.") - self.error_message = msg % self.__dict__ + msg = (_("Only %(value)s %(verb)s request(s) can be " + "made to %(uri)s every %(unit_string)s.") % + {'value': self.value, 'verb': self.verb, + 'uri': self.uri, 'unit_string': self.unit_string}) + self.error_message = msg def __call__(self, verb, url): """Represent a call to this limit from a relevant request. diff --git a/cinder/tests/scheduler/test_goodness_weigher.py b/cinder/tests/scheduler/test_goodness_weigher.py index c4e30b6ef..29cfa7fcd 100644 --- a/cinder/tests/scheduler/test_goodness_weigher.py +++ b/cinder/tests/scheduler/test_goodness_weigher.py @@ -182,4 +182,4 @@ class GoodnessWeigherTestCase(test.TestCase): weight_properties = {} weight = weigher._weigh_object(host_state, weight_properties) - self.assertEqual(0, weight) \ No newline at end of file + self.assertEqual(0, weight) diff --git a/cinder/tests/test_hacking.py b/cinder/tests/test_hacking.py index c159466cf..db69b8a1a 100644 --- a/cinder/tests/test_hacking.py +++ b/cinder/tests/test_hacking.py @@ -198,4 +198,4 @@ class HackingTestCase(test.TestCase): self.assertEqual(0, len(list(checks.validate_log_translations( "LOG.error(_LE('foo')", "foo.py")))) self.assertEqual(0, len(list(checks.validate_log_translations( - "LOG.exception(_LE('foo')", "foo.py")))) \ No newline at end of file + "LOG.exception(_LE('foo')", "foo.py")))) diff --git a/cinder/volume/drivers/prophetstor/dpl_iscsi.py b/cinder/volume/drivers/prophetstor/dpl_iscsi.py index 3a3b1411f..157fa3f6b 100644 --- a/cinder/volume/drivers/prophetstor/dpl_iscsi.py +++ b/cinder/volume/drivers/prophetstor/dpl_iscsi.py @@ -153,4 +153,4 @@ class DPLISCSIDriver(dplcommon.DPLCOMMONDriver, except Exception as exc: LOG.warning(_LW('Cannot get volume status ' '%(exc)s.'), {'exc': exc}) - return self._stats \ No newline at end of file + return self._stats diff --git a/test-requirements.txt b/test-requirements.txt index ef4878be7..721d1dc29 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,7 +3,8 @@ # process, which may cause wedges in the gate later. # Install bounded pep8/pyflakes first, then let flake8 install -hacking>=0.9.2,<0.10 +hacking<0.11,>=0.10.0 + coverage>=3.6 discover fixtures>=0.3.14 diff --git a/tox.ini b/tox.ini index b5d5d82ec..6a991857d 100644 --- a/tox.ini +++ b/tox.ini @@ -55,22 +55,18 @@ commands = python setup.py build_sphinx # E251 unexpected spaces around keyword / parameter equals # reason: no improvement in readability # -# H402 one line docstring needs punctuation -# reason: removed in hacking (https://review.openstack.org/#/c/101497/) -# -# H803 git commit title should not end with period -# reason: removed in hacking (https://review.openstack.org/#/c/101498/) -# -# H904 wrap long lines in parentheses instead of a backslash -# reason: removed in hacking (https://review.openstack.org/#/c/101701/) -# # Due to the upgrade to hacking 0.9.2 the following checking are # ignored on purpose for the moment and should be re-enabled. # # H405 +# Due to the upgrade to hacking 0.10.0 the following checking are +# ignored on purpose for the moment and should be cleaned up and re-enabled. +# +# H238 old style class declaration, use new style (inherit from `object`) +# H105 Don't use author tags +# - -ignore = E251,H402,H405,H803,H904 +ignore = E251,H405,H238,H105 exclude = .git,.venv,.tox,dist,tools,doc,common,*egg,build max-complexity=30 -- 2.45.2