Deprecate N523 check that forbids oslo.* imports

Oslo libraries don't ship oslo.* import namespace for a while, so there
is no real need to check against its usage. Since the module is public,
we need to follow deprecation process.

Note that only direct usage of the check is supported. Factory does not
register it anymore.

Change-Id: I48dc1555fd2c77708fd44f3eed4617f636c346de
This commit is contained in:
Ihar Hrachyshka
2016-07-21 14:27:34 +02:00
parent 38d2dc4302
commit 7c09268021
2 changed files with 4 additions and 2 deletions

View File

@@ -9,7 +9,7 @@ Neutron Specific Commandments
----------------------------- -----------------------------
- [N521] Validate that jsonutils module is used instead of json - [N521] Validate that jsonutils module is used instead of json
- [N523] Enforce namespace-less imports for oslo libraries - [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.

View File

@@ -14,6 +14,8 @@
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
@@ -92,6 +94,7 @@ 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): def check_oslo_namespace_imports(logical_line):
x = _check_namespace_imports('N523', 'oslo', 'oslo_', logical_line) x = _check_namespace_imports('N523', 'oslo', 'oslo_', logical_line)
if x is not None: if x is not None:
@@ -150,7 +153,6 @@ def check_neutron_namespace_imports(logical_line):
def factory(register): def factory(register):
register(use_jsonutils) register(use_jsonutils)
register(check_oslo_namespace_imports)
register(check_no_contextlib_nested) register(check_no_contextlib_nested)
register(check_python3_xrange) register(check_python3_xrange)
register(check_no_basestring) register(check_no_basestring)