Clean up check signatures
Flake8 3.0 enforces the check signature contract that was detailed in 2.x. To prepare Hacking for Flake8 3.0's release, we need to clean up our signatures and stop requesting both logical_line and physical_line, especially when we don't use both in each of those cases. Change-Id: Id55eadb66599a9bf240c837dafa88737aa024a16 Closes-bug: 1597729
This commit is contained in:
parent
fa24ccae16
commit
c8f3bc26a2
@ -22,7 +22,7 @@ LOCALS_TEXT_MAP = {
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
def hacking_no_locals(logical_line, physical_line, tokens, noqa):
|
||||
def hacking_no_locals(logical_line, tokens, noqa):
|
||||
"""Do not use locals() or self.__dict__ for string formatting.
|
||||
|
||||
Okay: 'locals()'
|
||||
|
@ -20,7 +20,7 @@ RE_ASSERT_RAISES_EXCEPTION = re.compile(r"self\.assertRaises\(Exception[,\)]")
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
def hacking_except_format(logical_line, physical_line, noqa):
|
||||
def hacking_except_format(logical_line, noqa):
|
||||
r"""Check for 'except:'.
|
||||
|
||||
OpenStack HACKING guide recommends not using except:
|
||||
@ -38,7 +38,7 @@ def hacking_except_format(logical_line, physical_line, noqa):
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
def hacking_except_format_assert(logical_line, physical_line, noqa):
|
||||
def hacking_except_format_assert(logical_line, noqa):
|
||||
r"""Check for 'assertRaises(Exception'.
|
||||
|
||||
OpenStack HACKING guide recommends not using assertRaises(Exception...):
|
||||
|
@ -18,7 +18,7 @@ RE_RELATIVE_IMPORT = re.compile('^from\s*[.]')
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
def hacking_import_rules(logical_line, physical_line, filename, noqa):
|
||||
def hacking_import_rules(logical_line, filename, noqa):
|
||||
r"""Check for imports.
|
||||
|
||||
OpenStack HACKING guide recommends one import per line:
|
||||
|
@ -21,7 +21,7 @@ RE_PRINT = re.compile(r"\bprint(?:$|\s+[^\(])")
|
||||
|
||||
@core.skip_on_py3
|
||||
@core.flake8ext
|
||||
def hacking_python3x_except_compatible(logical_line, physical_line, noqa):
|
||||
def hacking_python3x_except_compatible(logical_line, noqa):
|
||||
r"""Check for except statements to be Python 3.x compatible
|
||||
|
||||
As of Python 3.x, the construct 'except x,y:' has been removed.
|
||||
@ -78,7 +78,7 @@ def hacking_python3x_octal_literals(logical_line, tokens, noqa):
|
||||
|
||||
@core.skip_on_py3
|
||||
@core.flake8ext
|
||||
def hacking_python3x_print_function(logical_line, physical_line, noqa):
|
||||
def hacking_python3x_print_function(logical_line, noqa):
|
||||
r"""Check that all print occurrences look like print functions.
|
||||
|
||||
Check that all occurrences of print look like functions, not
|
||||
@ -143,7 +143,7 @@ def hacking_no_assert_underscore(logical_line, tokens, noqa):
|
||||
|
||||
|
||||
@core.flake8ext
|
||||
def hacking_python3x_metaclass(logical_line, physical_line, noqa):
|
||||
def hacking_python3x_metaclass(logical_line, noqa):
|
||||
r"""Check for metaclass to be Python 3.x compatible.
|
||||
|
||||
Okay: @six.add_metaclass(Meta)\nclass Foo(object):\n pass
|
||||
|
Loading…
Reference in New Issue
Block a user