]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Update hacking to 0.10
authorIhar Hrachyshka <ihrachys@redhat.com>
Mon, 12 Jan 2015 16:04:14 +0000 (17:04 +0100)
committerIhar Hrachyshka <ihrachys@redhat.com>
Mon, 12 Jan 2015 22:46:06 +0000 (23:46 +0100)
Release notes:
http://git.openstack.org/cgit/openstack-dev/hacking/tag/?id=0.10.0

* Remove references in tox.ini to removed rules.
* Remove custom @author check since it's now implemented in hacking.
* Move N323 to N322 that is freed due to @author check removal.
* Temporarily skip W292 (no newline at the end of file).
* Temporarily skip H238 (old style classes).

Change-Id: I6d990a564df6a312bd09b2a152315bbdba732082

HACKING.rst
neutron/hacking/checks.py
neutron/tests/unit/test_hacking.py
test-requirements.txt
tox.ini

index e08eb54224bab9d7234cdc583e578b6a1fea7756..5250e988bd4dd5e2a38d622476a04384bf03eb47 100644 (file)
@@ -11,9 +11,7 @@ Neutron Specific Commandments
 - [N319] Validate that debug level logs are not translated
 - [N320] Validate that LOG messages, except debug ones, have translations
 - [N321] Validate that jsonutils module is used instead of json
-- [N322] We do not use @authors tags in source files. We have git to track
-  authorship.
-- [N323] Detect common errors with assert_called_once_with
+- [N322] Detect common errors with assert_called_once_with
 
 Creating Unit Tests
 -------------------
index 9a1b40b76b932dc2dd6b6997beb0d7c3d529d16e..03f3ead523f315320243b26ef930b2970a2304e9 100644 (file)
@@ -28,8 +28,6 @@ import pep8
 #  - Add test cases for each new rule to
 #    neutron/tests/unit/test_hacking.py
 
-author_tag_re = re.compile(r"^\s*#\s*@?[aA]uthor|^\.\.\s+moduleauthor::")
-
 _all_log_levels = {
     # NOTE(yamamoto): Following nova which uses _() for audit.
     'audit': '_',
@@ -88,15 +86,6 @@ def use_jsonutils(logical_line, filename):
                 yield (pos, msg % {'fun': f[:-1]})
 
 
-def no_author_tags(physical_line):
-    if author_tag_re.match(physical_line):
-        physical_line = physical_line.lower()
-        pos = physical_line.find('moduleauthor')
-        if pos < 0:
-            pos = physical_line.find('author')
-        return pos, "N322: Don't use author tags"
-
-
 def no_translate_debug_logs(logical_line, filename):
     """Check for 'LOG.debug(_(' and 'LOG.debug(_Lx('
 
@@ -120,7 +109,7 @@ def check_assert_called_once_with(logical_line, filename):
         if '.assert_called_once_with(' in logical_line:
             return
         if '.assertcalledonce' in logical_line.lower().replace('_', ''):
-            msg = ("N323: Possible use of no-op mock method. "
+            msg = ("N322: Possible use of no-op mock method. "
                    "please use assert_called_once_with.")
             yield (0, msg)
 
@@ -128,6 +117,5 @@ def check_assert_called_once_with(logical_line, filename):
 def factory(register):
     register(validate_log_translations)
     register(use_jsonutils)
-    register(no_author_tags)
     register(check_assert_called_once_with)
     register(no_translate_debug_logs)
index bf1bcaf15ce10e3e2733d81a1b0daaeed9812aed..642ba6ab17eaba5abf517c7679dff11700dd1e0f 100644 (file)
@@ -80,18 +80,6 @@ class HackingTestCase(base.BaseTestCase):
                     "./neutron/plugins/openvswitch/agent/xenapi/etc/xapi.d/"
                     "plugins/netwrap"))))
 
-    def test_no_author_tags(self):
-        self.assertIsInstance(checks.no_author_tags("# author: pele"), tuple)
-        self.assertIsInstance(checks.no_author_tags("# @author: pele"), tuple)
-        self.assertIsInstance(checks.no_author_tags("# @Author: pele"), tuple)
-        self.assertIsInstance(checks.no_author_tags("# Author: pele"), tuple)
-        self.assertIsInstance(checks.no_author_tags("# Author pele"), tuple)
-        self.assertIsInstance(checks.no_author_tags(".. moduleauthor:: pele"),
-                              tuple)
-        self.assertEqual(2, checks.no_author_tags("# author: pele")[0])
-        self.assertEqual(2, checks.no_author_tags("# Author: pele")[0])
-        self.assertEqual(3, checks.no_author_tags(".. moduleauthor:: pele")[0])
-
     def test_assert_called_once_with(self):
         fail_code1 = """
                mock = Mock()
index 26cf54526a4e0661037ce1eb9f07444c8b5a4dac..887a16958c97cb51c0f0cda4fa73e450b6f66af5 100644 (file)
@@ -1,7 +1,7 @@
 # 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
 # process, which may cause wedges in the gate later.
-hacking>=0.9.2,<0.10
+hacking>=0.10.0,<0.11
 
 cliff>=1.7.0  # Apache-2.0
 coverage>=3.6
diff --git a/tox.ini b/tox.ini
index 2d923ae5a50b5367d812e021a6a541d0b484f11b..1ef7f9864d5a9719d05afc321e5c695af26e34c5 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -75,13 +75,12 @@ commands = python setup.py build_sphinx
 # E128 continuation line under-indented for visual indent
 # E129 visually indented line with same indent as next logical line
 # E265 block comment should start with ‘# ‘
+# H238 old style class declaration, use new style
 # H305 imports not grouped correctly
-# H307 like imports should be grouped together
-# H402 one line docstring needs punctuation
 # H404 multi line docstring should start with a summary
 # H405 multi line docstring summary not separated with an empty line
-# H904 Wrap long lines in parentheses instead of a backslash
-ignore = E125,E126,E128,E129,E265,H305,H307,H402,H404,H405,H904
+# W292 no newline at end of file
+ignore = E125,E126,E128,E129,E265,H238,H305,H404,H405,W292
 show-source = true
 builtins = _
 # TODO(dougw) neutron/tests/unit/vmware exclusion is a temporary services split hack