Fix the duplicate hacking check M312 and H203
The hacking "[H203] Use assertIs(Not)None to check for None" is already enabled in tox. But the local hacking M312 is also avaliable, there is no need to check twice here for the same check. Change-Id: I56e19c6dd8905e439247c3b142e74913b5d0d7a6 Closes-Bug: #1710426
This commit is contained in:
parent
80fe5f1fe4
commit
ca712cb0bd
@ -10,7 +10,6 @@ Manila Specific Commandments
|
|||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
- [M310] Check for improper use of logging format arguments.
|
- [M310] Check for improper use of logging format arguments.
|
||||||
- [M312] Use assertIsNone(...) instead of assertEqual(None, ...).
|
|
||||||
- [M313] Use assertTrue(...) rather than assertEqual(True, ...).
|
- [M313] Use assertTrue(...) rather than assertEqual(True, ...).
|
||||||
- [M323] Ensure that the _() function is explicitly imported to ensure proper translations.
|
- [M323] Ensure that the _() function is explicitly imported to ensure proper translations.
|
||||||
- [M325] str() and unicode() cannot be used on an exception. Remove or use six.text_type().
|
- [M325] str() and unicode() cannot be used on an exception. Remove or use six.text_type().
|
||||||
|
@ -51,7 +51,6 @@ oslo_namespace_imports = re.compile(r"from[\s]*oslo[.](.*)")
|
|||||||
dict_constructor_with_list_copy_re = re.compile(r".*\bdict\((\[)?(\(|\[)")
|
dict_constructor_with_list_copy_re = re.compile(r".*\bdict\((\[)?(\(|\[)")
|
||||||
assert_no_xrange_re = re.compile(r"\s*xrange\s*\(")
|
assert_no_xrange_re = re.compile(r"\s*xrange\s*\(")
|
||||||
assert_True = re.compile(r".*assertEqual\(True, .*\)")
|
assert_True = re.compile(r".*assertEqual\(True, .*\)")
|
||||||
assert_None = re.compile(r".*assertEqual\(None, .*\)")
|
|
||||||
no_log_warn = re.compile(r"\s*LOG.warn\(.*")
|
no_log_warn = re.compile(r"\s*LOG.warn\(.*")
|
||||||
|
|
||||||
|
|
||||||
@ -290,13 +289,6 @@ def validate_assertTrue(logical_line):
|
|||||||
yield(0, msg)
|
yield(0, msg)
|
||||||
|
|
||||||
|
|
||||||
def validate_assertIsNone(logical_line):
|
|
||||||
if re.match(assert_None, logical_line):
|
|
||||||
msg = ("M312: Unit tests should use assertIsNone(value) instead"
|
|
||||||
" of using assertEqual(None, value).")
|
|
||||||
yield(0, msg)
|
|
||||||
|
|
||||||
|
|
||||||
def check_uuid4(logical_line):
|
def check_uuid4(logical_line):
|
||||||
"""Generating UUID
|
"""Generating UUID
|
||||||
|
|
||||||
@ -338,6 +330,5 @@ def factory(register):
|
|||||||
register(dict_constructor_with_list_copy)
|
register(dict_constructor_with_list_copy)
|
||||||
register(no_xrange)
|
register(no_xrange)
|
||||||
register(validate_assertTrue)
|
register(validate_assertTrue)
|
||||||
register(validate_assertIsNone)
|
|
||||||
register(check_uuid4)
|
register(check_uuid4)
|
||||||
register(no_log_warn_check)
|
register(no_log_warn_check)
|
||||||
|
@ -314,13 +314,6 @@ class HackingTestCase(test.TestCase):
|
|||||||
self.assertEqual(1, len(list(checks.validate_assertTrue(
|
self.assertEqual(1, len(list(checks.validate_assertTrue(
|
||||||
"assertEqual(True, %s)" % test_value))))
|
"assertEqual(True, %s)" % test_value))))
|
||||||
|
|
||||||
def test_validate_assertIsNone(self):
|
|
||||||
test_value = None
|
|
||||||
self.assertEqual(0, len(list(checks.validate_assertIsNone(
|
|
||||||
"assertIsNone(None)"))))
|
|
||||||
self.assertEqual(1, len(list(checks.validate_assertIsNone(
|
|
||||||
"assertEqual(None, %s)" % test_value))))
|
|
||||||
|
|
||||||
def test_check_uuid4(self):
|
def test_check_uuid4(self):
|
||||||
code = """
|
code = """
|
||||||
fake_uuid = uuid.uuid4()
|
fake_uuid = uuid.uuid4()
|
||||||
|
Loading…
Reference in New Issue
Block a user