diff --git a/openstack/_hacking.py b/openstack/_hacking.py index 94952630c..01b05adfc 100644 --- a/openstack/_hacking.py +++ b/openstack/_hacking.py @@ -14,6 +14,8 @@ import re +from hacking import core + """ Guidelines for writing new hacking checks @@ -31,6 +33,7 @@ Guidelines for writing new hacking checks SETUPCLASS_RE = re.compile(r"def setUpClass\(") +@core.flake8ext def assert_no_setupclass(logical_line): """Check for use of setUpClass @@ -38,7 +41,3 @@ def assert_no_setupclass(logical_line): """ if SETUPCLASS_RE.match(logical_line): yield (0, "O300: setUpClass not allowed") - - -def factory(register): - register(assert_no_setupclass) diff --git a/tox.ini b/tox.ini index b55de9b3f..3e6f1bfd0 100644 --- a/tox.ini +++ b/tox.ini @@ -45,9 +45,6 @@ commands = flake8 doc8 doc/source README.rst -[hacking] -local-check-factory = openstack._hacking.factory - [testenv:venv] deps = -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} @@ -119,6 +116,11 @@ ignore = H306,H4,W503 show-source = True exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,openstack/_services_mixin.py +[flake8:local-plugins] +extension = + O300 = _hacking:assert_no_setupclass +paths = ./openstack + [doc8] extensions = .rst, .yaml