Merge "Hacking: Remove N333 oslo namespace import check"
This commit is contained in:
commit
7880246ca1
@ -15,7 +15,6 @@ Cinder Specific Commandments
|
||||
- [N328] LOG.info messages require translations `_LI()`.
|
||||
- [N329] LOG.exception and LOG.error messages require translations `_LE()`.
|
||||
- [N330] LOG.warning messages require translations `_LW()`.
|
||||
- [N333] Ensure that oslo namespaces are used for namespaced libraries.
|
||||
- [N336] Must use a dict comprehension instead of a dict constructor with a sequence of key-value pairs.
|
||||
- [C301] timeutils.utcnow() from oslo_utils should be used instead of datetime.now().
|
||||
- [C302] six.text_type should be used instead of unicode.
|
||||
|
@ -383,14 +383,6 @@ def validate_log_translations(logical_line, filename):
|
||||
yield (0, msg)
|
||||
|
||||
|
||||
def check_oslo_namespace_imports(logical_line):
|
||||
if re.match(oslo_namespace_imports, logical_line):
|
||||
msg = ("N333: '%s' must be used instead of '%s'.") % (
|
||||
logical_line.replace('oslo.', 'oslo_'),
|
||||
logical_line)
|
||||
yield(0, msg)
|
||||
|
||||
|
||||
def check_datetime_now(logical_line, noqa):
|
||||
if noqa:
|
||||
return
|
||||
@ -500,7 +492,6 @@ def factory(register):
|
||||
register(CheckForStrUnicodeExc)
|
||||
register(CheckLoggingFormatArgs)
|
||||
register(CheckOptRegistrationArgs)
|
||||
register(check_oslo_namespace_imports)
|
||||
register(check_datetime_now)
|
||||
register(check_timeutils_strtime)
|
||||
register(check_timeutils_isotime)
|
||||
|
@ -294,32 +294,6 @@ class HackingTestCase(test.TestCase):
|
||||
self.assertEqual(1, len(list(checks.no_mutable_default_args(
|
||||
"def foo (bar={}):"))))
|
||||
|
||||
def test_oslo_namespace_imports_check(self):
|
||||
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
|
||||
"from oslo.concurrency import foo"))))
|
||||
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
|
||||
"from oslo_concurrency import bar"))))
|
||||
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
|
||||
"from oslo.db import foo"))))
|
||||
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
|
||||
"from oslo_db import bar"))))
|
||||
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
|
||||
"from oslo.config import foo"))))
|
||||
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
|
||||
"from oslo_config import bar"))))
|
||||
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
|
||||
"from oslo.utils import foo"))))
|
||||
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
|
||||
"from oslo_utils import bar"))))
|
||||
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
|
||||
"from oslo.serialization import foo"))))
|
||||
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
|
||||
"from oslo_serialization import bar"))))
|
||||
self.assertEqual(1, len(list(checks.check_oslo_namespace_imports(
|
||||
"from oslo.log import foo"))))
|
||||
self.assertEqual(0, len(list(checks.check_oslo_namespace_imports(
|
||||
"from oslo_log import bar"))))
|
||||
|
||||
def test_check_datetime_now(self):
|
||||
self.assertEqual(1, len(list(checks.check_datetime_now(
|
||||
"datetime.now", False))))
|
||||
|
Loading…
Reference in New Issue
Block a user