diff --git a/horizon/hacking/checks.py b/horizon/hacking/checks.py index 4a61166f8e..60872bcbf4 100644 --- a/horizon/hacking/checks.py +++ b/horizon/hacking/checks.py @@ -15,6 +15,8 @@ import re +from hacking import core + """ Guidelines for writing new hacking checks - Use only for Horizon specific tests. OpenStack general tests @@ -31,11 +33,8 @@ Guidelines for writing new hacking checks mutable_default_args = re.compile(r"^\s*def .+\((.+=\{\}|.+=\[\])") +@core.flake8ext def no_mutable_default_args(logical_line): msg = "M322: Method's default argument shouldn't be mutable!" if mutable_default_args.match(logical_line): yield (0, msg) - - -def factory(register): - register(no_mutable_default_args) diff --git a/tox.ini b/tox.ini index 4bf1a423c3..52a4902694 100644 --- a/tox.ini +++ b/tox.ini @@ -184,8 +184,9 @@ max_line_length = 80 import-order-style = pep8 application-import-names = horizon,openstack_dashboard -[hacking] -local-check-factory = horizon.hacking.checks.factory +[flake8:local-plugins] +extension = + M322 = horizon.hacking.checks:no_mutable_default_args [doc8] # File extensions to check