remove deprecated N523 hacking check
The N523 hacking check check_oslo_namespace_imports has been removed. This hacking check has been deprecated and scheduled for removal in Pike and no consumers directly rely on it today [1][2]. [1] http://codesearch.openstack.org/?q=N523 [2] http://codesearch.openstack.org/?q=check_oslo_namespace_imports Change-Id: Ie041ddca1c07ca76a32c5974b0de41adf0402102
This commit is contained in:
@@ -9,7 +9,6 @@ Neutron Library Specific Commandments
|
|||||||
-------------------------------------
|
-------------------------------------
|
||||||
|
|
||||||
- [N521] Validate that jsonutils module is used instead of json
|
- [N521] Validate that jsonutils module is used instead of json
|
||||||
- [N523] DEPRECATED. Enforce namespace-less imports for oslo libraries
|
|
||||||
- [N524] Prevent use of deprecated contextlib.nested.
|
- [N524] Prevent use of deprecated contextlib.nested.
|
||||||
- [N525] Python 3: Do not use xrange.
|
- [N525] Python 3: Do not use xrange.
|
||||||
- [N526] Python 3: do not use basestring.
|
- [N526] Python 3: do not use basestring.
|
||||||
|
|||||||
@@ -14,8 +14,6 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from debtcollector import removals
|
|
||||||
|
|
||||||
from neutron_lib.hacking import translation_checks
|
from neutron_lib.hacking import translation_checks
|
||||||
|
|
||||||
# Guidelines for writing new hacking checks
|
# Guidelines for writing new hacking checks
|
||||||
@@ -107,21 +105,6 @@ def _check_namespace_imports(failure_code, namespace, new_ns, logical_line,
|
|||||||
return (0, msg_o or msg)
|
return (0, msg_o or msg)
|
||||||
|
|
||||||
|
|
||||||
@removals.remove(removal_version='P release')
|
|
||||||
def check_oslo_namespace_imports(logical_line):
|
|
||||||
"""N523 - Import oslo_ rather than oslo.
|
|
||||||
|
|
||||||
:param logical_line: The logical line to check.
|
|
||||||
:param filename: The file name where the logical line exists.
|
|
||||||
:returns: None if the logical line passes the check, otherwise a tuple
|
|
||||||
is yielded that contains the offending index in logical line and a
|
|
||||||
message describe the check validation failure.
|
|
||||||
"""
|
|
||||||
x = _check_namespace_imports('N523', 'oslo', 'oslo_', logical_line)
|
|
||||||
if x is not None:
|
|
||||||
yield x
|
|
||||||
|
|
||||||
|
|
||||||
def check_no_contextlib_nested(logical_line, filename):
|
def check_no_contextlib_nested(logical_line, filename):
|
||||||
"""N524 - Use of contextlib.nested is deprecated.
|
"""N524 - Use of contextlib.nested is deprecated.
|
||||||
|
|
||||||
|
|||||||
@@ -80,14 +80,6 @@ class HackingTestCase(base.BaseTestCase):
|
|||||||
"./neutron/plugins/ml2/drivers/openvswitch/agent/xenapi/"
|
"./neutron/plugins/ml2/drivers/openvswitch/agent/xenapi/"
|
||||||
"etc/xapi.d/plugins/netwrap"))))
|
"etc/xapi.d/plugins/netwrap"))))
|
||||||
|
|
||||||
def test_check_oslo_namespace_imports(self):
|
|
||||||
f = checks.check_oslo_namespace_imports
|
|
||||||
self.assertLinePasses(f, 'from oslo_utils import importutils')
|
|
||||||
self.assertLinePasses(f, 'import oslo_messaging')
|
|
||||||
self.assertLineFails(f, 'from oslo.utils import importutils')
|
|
||||||
self.assertLineFails(f, 'from oslo import messaging')
|
|
||||||
self.assertLineFails(f, 'import oslo.messaging')
|
|
||||||
|
|
||||||
def test_check_contextlib_nested(self):
|
def test_check_contextlib_nested(self):
|
||||||
f = checks.check_no_contextlib_nested
|
f = checks.check_no_contextlib_nested
|
||||||
self.assertLineFails(f, 'with contextlib.nested():', '')
|
self.assertLineFails(f, 'with contextlib.nested():', '')
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
other:
|
||||||
|
- The deprecated ``N523`` hacking check that ensures proper oslo namespace
|
||||||
|
imports has been removed.
|
||||||
Reference in New Issue
Block a user