Merge "Drop unicode() hacking check"
This commit is contained in:
commit
a9221afda4
|
@ -309,20 +309,6 @@ def check_datetime_now(logical_line, noqa):
|
||||||
yield(0, msg)
|
yield(0, msg)
|
||||||
|
|
||||||
|
|
||||||
_UNICODE_USAGE_REGEX = re.compile(r'\bunicode *\(')
|
|
||||||
|
|
||||||
|
|
||||||
@core.flake8ext
|
|
||||||
def check_unicode_usage(logical_line, noqa):
|
|
||||||
if noqa:
|
|
||||||
return
|
|
||||||
|
|
||||||
msg = "C302: Found unicode() call. Please use six.text_type()."
|
|
||||||
|
|
||||||
if _UNICODE_USAGE_REGEX.search(logical_line):
|
|
||||||
yield(0, msg)
|
|
||||||
|
|
||||||
|
|
||||||
@core.flake8ext
|
@core.flake8ext
|
||||||
def check_no_print_statements(logical_line, filename, noqa):
|
def check_no_print_statements(logical_line, filename, noqa):
|
||||||
# CLI and utils programs do need to use 'print()' so
|
# CLI and utils programs do need to use 'print()' so
|
||||||
|
|
|
@ -219,12 +219,6 @@ class HackingTestCase(test.TestCase):
|
||||||
self.assertEqual(0, len(list(checks.check_timeutils_strtime(
|
self.assertEqual(0, len(list(checks.check_timeutils_strtime(
|
||||||
"strftime"))))
|
"strftime"))))
|
||||||
|
|
||||||
def test_check_unicode_usage(self):
|
|
||||||
self.assertEqual(1, len(list(checks.check_unicode_usage(
|
|
||||||
"unicode(msg)", False))))
|
|
||||||
self.assertEqual(0, len(list(checks.check_unicode_usage(
|
|
||||||
"unicode(msg) # noqa", True))))
|
|
||||||
|
|
||||||
def test_no_print_statements(self):
|
def test_no_print_statements(self):
|
||||||
self.assertEqual(0, len(list(checks.check_no_print_statements(
|
self.assertEqual(0, len(list(checks.check_no_print_statements(
|
||||||
"a line with no print statement",
|
"a line with no print statement",
|
||||||
|
|
14
tox.ini
14
tox.ini
|
@ -199,24 +199,20 @@ max-complexity = 30
|
||||||
application-import-names = cinder
|
application-import-names = cinder
|
||||||
import-order-style = pep8
|
import-order-style = pep8
|
||||||
|
|
||||||
[hacking]
|
|
||||||
import_exceptions = cinder.i18n
|
|
||||||
|
|
||||||
[flake8:local-plugins]
|
[flake8:local-plugins]
|
||||||
extension =
|
extension =
|
||||||
C312 = checks:no_translate_logs
|
|
||||||
N322 = checks:no_mutable_default_args
|
N322 = checks:no_mutable_default_args
|
||||||
N323 = checks:check_explicit_underscore_import
|
N323 = checks:check_explicit_underscore_import
|
||||||
C310 = checks:CheckLoggingFormatArgs
|
|
||||||
C311 = checks:CheckOptRegistrationArgs
|
|
||||||
C301 = checks:check_datetime_now
|
C301 = checks:check_datetime_now
|
||||||
|
C303 = checks:check_no_print_statements
|
||||||
C306 = checks:check_timeutils_strtime
|
C306 = checks:check_timeutils_strtime
|
||||||
C308 = checks:check_timeutils_isotime
|
C308 = checks:check_timeutils_isotime
|
||||||
C302 = checks:check_unicode_usage
|
|
||||||
C303 = checks:check_no_print_statements
|
|
||||||
C336 = checks:dict_constructor_with_list_copy
|
|
||||||
C309 = checks:no_test_log
|
C309 = checks:no_test_log
|
||||||
|
C310 = checks:CheckLoggingFormatArgs
|
||||||
|
C311 = checks:CheckOptRegistrationArgs
|
||||||
|
C312 = checks:no_translate_logs
|
||||||
C313 = checks:validate_assertTrue
|
C313 = checks:validate_assertTrue
|
||||||
|
C336 = checks:dict_constructor_with_list_copy
|
||||||
paths = ./cinder/tests/hacking
|
paths = ./cinder/tests/hacking
|
||||||
|
|
||||||
[doc8]
|
[doc8]
|
||||||
|
|
Loading…
Reference in New Issue