Remove oslo import hacking check

The oslo libraries have removed the oslo.* modules so using this
style of imports will fail, so the hacking check verifying that
all oslo imports are done using oslo_* isn't necessary.

Change-Id: I6b318bfccd0f6dd42c67b725563d445e793acdb8
This commit is contained in:
Brant Knudson 2015-08-02 11:10:30 -05:00
parent e08d5f219a
commit b0bdeeb9e4
3 changed files with 0 additions and 100 deletions

View File

@ -403,17 +403,6 @@ class CheckForLoggingIssues(BaseASTChecker):
return False
def check_oslo_namespace_imports(logical_line, blank_before, filename):
oslo_namespace_imports = re.compile(
r"(((from)|(import))\s+oslo\.)|(from\s+oslo\s+import\s+)")
if re.match(oslo_namespace_imports, logical_line):
msg = ("K333: '%s' must be used instead of '%s'.") % (
logical_line.replace('oslo.', 'oslo_'),
logical_line)
yield(0, msg)
def dict_constructor_with_sequence_copy(logical_line):
"""Should use a dict comprehension instead of a dict constructor.
@ -442,5 +431,4 @@ def factory(register):
register(block_comments_begin_with_a_space)
register(CheckForAssertingNoneEquality)
register(CheckForLoggingIssues)
register(check_oslo_namespace_imports)
register(dict_constructor_with_sequence_copy)

View File

@ -179,84 +179,6 @@ class HackingCode(fixtures.Fixture):
]
}
oslo_namespace_imports = {
'code': """
import oslo.utils
import oslo_utils
import oslo.utils.encodeutils
import oslo_utils.encodeutils
from oslo import utils
from oslo.utils import encodeutils
from oslo_utils import encodeutils
import oslo.serialization
import oslo_serialization
import oslo.serialization.jsonutils
import oslo_serialization.jsonutils
from oslo import serialization
from oslo.serialization import jsonutils
from oslo_serialization import jsonutils
import oslo.messaging
import oslo_messaging
import oslo.messaging.conffixture
import oslo_messaging.conffixture
from oslo import messaging
from oslo.messaging import conffixture
from oslo_messaging import conffixture
import oslo.db
import oslo_db
import oslo.db.api
import oslo_db.api
from oslo import db
from oslo.db import api
from oslo_db import api
import oslo.config
import oslo_config
import oslo.config.cfg
import oslo_config.cfg
from oslo import config
from oslo.config import cfg
from oslo_config import cfg
import oslo.i18n
import oslo_i18n
import oslo.i18n.log
import oslo_i18n.log
from oslo import i18n
from oslo.i18n import log
from oslo_i18n import log
""",
'expected_errors': [
(1, 0, 'K333'),
(3, 0, 'K333'),
(5, 0, 'K333'),
(6, 0, 'K333'),
(9, 0, 'K333'),
(11, 0, 'K333'),
(13, 0, 'K333'),
(14, 0, 'K333'),
(17, 0, 'K333'),
(19, 0, 'K333'),
(21, 0, 'K333'),
(22, 0, 'K333'),
(25, 0, 'K333'),
(27, 0, 'K333'),
(29, 0, 'K333'),
(30, 0, 'K333'),
(33, 0, 'K333'),
(35, 0, 'K333'),
(37, 0, 'K333'),
(38, 0, 'K333'),
(41, 0, 'K333'),
(43, 0, 'K333'),
(45, 0, 'K333'),
(46, 0, 'K333'),
],
}
dict_constructor = {
'code': """
lower_res = {k.lower(): v for k, v in six.iteritems(res[1])}

View File

@ -122,16 +122,6 @@ class TestCheckForNonDebugLoggingIssues(BaseStyleCheck):
self.assertEqual(expected_errors or [], actual_errors)
class TestCheckOsloNamespaceImports(BaseStyleCheck):
def get_checker(self):
return checks.check_oslo_namespace_imports
def test(self):
code = self.code_ex.oslo_namespace_imports['code']
errors = self.code_ex.oslo_namespace_imports['expected_errors']
self.assert_has_errors(code, expected_errors=errors)
class TestDictConstructorWithSequenceCopy(BaseStyleCheck):
def get_checker(self):