Remove check V320 in PY3
Remove checks:no_direct_use_of_unicode_function, there is no unicode builtin in python3. Change-Id: Ief8c922637e562fcab20f3c97b496b950c7f36ea
This commit is contained in:
parent
38da3437ed
commit
e59ffcfa81
|
@ -10,7 +10,6 @@ Vitrage Specific Commandments
|
||||||
[V317] assertEqual(type(A), B) sentences not allowed
|
[V317] assertEqual(type(A), B) sentences not allowed
|
||||||
[V318] assertEqual(A, None) or assertEqual(None, A) sentences not allowed
|
[V318] assertEqual(A, None) or assertEqual(None, A) sentences not allowed
|
||||||
[V319] Don't translate logs
|
[V319] Don't translate logs
|
||||||
[V320] Use six.text_type() instead of unicode()
|
|
||||||
[V321] contextlib.nested is deprecated
|
[V321] contextlib.nested is deprecated
|
||||||
[V322] use a dict comprehension instead of a dict constructor with a sequence of key-value pairs
|
[V322] use a dict comprehension instead of a dict constructor with a sequence of key-value pairs
|
||||||
[V323] Do not use xrange. Use range, or six.moves.range
|
[V323] Do not use xrange. Use range, or six.moves.range
|
||||||
|
|
1
tox.ini
1
tox.ini
|
@ -73,7 +73,6 @@ extension =
|
||||||
V329 = checks:check_assert_true_false
|
V329 = checks:check_assert_true_false
|
||||||
V317 = checks:assert_equal_type
|
V317 = checks:assert_equal_type
|
||||||
V319 = checks:no_translate_logs
|
V319 = checks:no_translate_logs
|
||||||
V320 = checks:no_direct_use_of_unicode_function
|
|
||||||
V327 = checks:no_mutable_default_args
|
V327 = checks:no_mutable_default_args
|
||||||
V321 = checks:check_no_contextlib_nested
|
V321 = checks:check_no_contextlib_nested
|
||||||
V322 = checks:dict_constructor_with_list_copy
|
V322 = checks:dict_constructor_with_list_copy
|
||||||
|
|
|
@ -70,16 +70,6 @@ def no_translate_logs(logical_line):
|
||||||
yield (0, "V319: Don't translate logs")
|
yield (0, "V319: Don't translate logs")
|
||||||
|
|
||||||
|
|
||||||
@core.flake8ext
|
|
||||||
def no_direct_use_of_unicode_function(logical_line):
|
|
||||||
"""Check for use of unicode() builtin
|
|
||||||
|
|
||||||
V320
|
|
||||||
"""
|
|
||||||
if unicode_func_re.match(logical_line):
|
|
||||||
yield(0, "V320: Use six.text_type() instead of unicode()")
|
|
||||||
|
|
||||||
|
|
||||||
@core.flake8ext
|
@core.flake8ext
|
||||||
def check_no_contextlib_nested(logical_line):
|
def check_no_contextlib_nested(logical_line):
|
||||||
msg = ("V321: contextlib.nested is deprecated since Python 2.7. See "
|
msg = ("V321: contextlib.nested is deprecated since Python 2.7. See "
|
||||||
|
|
|
@ -48,19 +48,6 @@ class HackingTestCase(base.BaseTest):
|
||||||
self.assertThat(list(checks.no_translate_logs(bad)),
|
self.assertThat(list(checks.no_translate_logs(bad)),
|
||||||
matchers.HasLength(1))
|
matchers.HasLength(1))
|
||||||
|
|
||||||
def test_no_direct_use_of_unicode_function(self):
|
|
||||||
self.assertThat(list(checks.no_direct_use_of_unicode_function(
|
|
||||||
"unicode('the party don't start til the unicode walks in')")),
|
|
||||||
matchers.HasLength(1))
|
|
||||||
self.assertThat(list(checks.no_direct_use_of_unicode_function(
|
|
||||||
"""unicode('something '
|
|
||||||
'something else""")), matchers.HasLength(1))
|
|
||||||
self.assertThat(list(checks.no_direct_use_of_unicode_function(
|
|
||||||
"six.text_type('party over')")), IsEmpty())
|
|
||||||
self.assertThat(list(checks.no_direct_use_of_unicode_function(
|
|
||||||
"not_actually_unicode('something completely different')")),
|
|
||||||
IsEmpty())
|
|
||||||
|
|
||||||
def test_no_contextlib_nested(self):
|
def test_no_contextlib_nested(self):
|
||||||
self.assertThat(list(checks.check_no_contextlib_nested(
|
self.assertThat(list(checks.check_no_contextlib_nested(
|
||||||
"with contextlib.nested(")), matchers.HasLength(1))
|
"with contextlib.nested(")), matchers.HasLength(1))
|
||||||
|
|
Loading…
Reference in New Issue