From de568b8a1c69acf04c6596439deed00e4c949f48 Mon Sep 17 00:00:00 2001 From: Boden R Date: Tue, 17 Jan 2017 13:17:44 -0700 Subject: [PATCH] Use a single hacking check factory While the intention of the incubating hacking check factory was to provide a means to roll-out new checks without breaking consumers [1], the complications involved with running 2 factories in a gate job [2] perhaps negate the benefits of this approach. Therefore, as per discussion with Armando (see the neutron IRC logs from Jan 9, 2017 at 18:58) this patch proposed we only have a single hacking check factory for all consumers. The implications are as follows: - All new adopter hacking checks go into the single factory. - Consumers failing the new pep8 hacking check will see the failure via neutron-lib periodic job. - Consumers fix failures ASAP. IFF a special case arises and we need to release neutron-lib before consumers adopt check(s), we can comment them out of the factory to mitigate as a whole. Or individual consumer project's can 'ignore' failing checks as outlined in the usage.rst of this patch. This patch updates the dev-ref as well as the code to implement the above scheme. [1] https://review.openstack.org/#/c/350723/ [2] https://review.openstack.org/#/c/412628/ Change-Id: I0a8b39052c0f81f2ecbab3923353be1537b89a65 --- doc/source/usage.rst | 30 +++++++++---------- neutron_lib/hacking/checks.py | 13 -------- neutron_lib/tests/unit/hacking/test_checks.py | 11 ------- .../one-hacking-factory-01053e8e3d88c3d5.yaml | 6 ++++ 4 files changed, 20 insertions(+), 40 deletions(-) create mode 100644 releasenotes/notes/one-hacking-factory-01053e8e3d88c3d5.yaml diff --git a/doc/source/usage.rst b/doc/source/usage.rst index 1f3d9ff6d..ca6e063dd 100644 --- a/doc/source/usage.rst +++ b/doc/source/usage.rst @@ -54,21 +54,19 @@ To adopt neutron-lib's hacking checks: In the example above, adopters should also add ``H904`` to the ``enable-extensions`` in their ``tox.ini``. -#. Actively adopt neutron-lib hacking checks that are incubating and will - soon become adopter checks by manually running the checks on your project. - This can be done by modifying your ``tox.ini`` to use the - ``incubating_factory`` in neutron-lib:: +#. Actively adopt neutron-lib hacking checks by running and monitoring + the neutron-lib periodic job (as per `stadium guidelines + `_ and + watching for announcements. Announcements regarding neutron-lib adopter + hacking checks will be communicated via openstack-dev email list + and `neutron meetings `_. - [hacking] - local-check-factory = neutron_lib.hacking.checks.incubating_factory + Under certain circumstances, adopters may need to ignore specific + neutron-lib hacking checks temporarily. This can be done using the + ``ignore`` property in the ``[flake8]`` section of your ``tox.ini``. + For example, to ignore the hacking check ``N536`` your tox.ini might + have:: - And then manually running pep8 on your project:: - - tox -e pep8 - - New adopter hacking checks in neutron-lib will be registered via the - ``incubating_factory`` while sub-projects are adopting the new check(s) - and then be moved out of incubating and into ``factory``. Announcements - regarding neutron-lib adopter hacking checks will be communicated via - openstack-dev email list and `neutron meetings - `_. + [flake8] + # temporarily ignore N536 while fixing failing checks + ignore = N536 diff --git a/neutron_lib/hacking/checks.py b/neutron_lib/hacking/checks.py index a34056b60..b1640abe7 100644 --- a/neutron_lib/hacking/checks.py +++ b/neutron_lib/hacking/checks.py @@ -261,18 +261,6 @@ def factory(register): register(translation_checks.no_translate_debug_logs) register(translation_checks.check_log_warn_deprecated) register(translation_checks.check_raised_localized_exceptions) - - -def incubating_factory(register): - """Hacking check factory for neutron-lib incubating checks. - - Hacking check factory for use with tox.ini. This factory registers all - neutron-lib incubating checks. Each incubating check will become an adopter - check after undergoing an incubation period. - - :param register: The function to register the check functions with. - :returns: None. - """ register(assert_equal_none) @@ -286,7 +274,6 @@ def _neutron_lib_factory(register): :returns: None. """ factory(register) - incubating_factory(register) # neutron-lib project specific checks below register(check_no_eventlet_imports) diff --git a/neutron_lib/tests/unit/hacking/test_checks.py b/neutron_lib/tests/unit/hacking/test_checks.py index 537608ac8..12205c09e 100644 --- a/neutron_lib/tests/unit/hacking/test_checks.py +++ b/neutron_lib/tests/unit/hacking/test_checks.py @@ -40,20 +40,9 @@ class HackingTestCase(base.BaseTestCase): def test_factory(self): self.assertTrue(len(self._get_factory_checks(checks.factory)) > 0) - def test_incubating_factory(self): - incubating_checks = self._get_factory_checks( - checks.incubating_factory) - - if incubating_checks: - adopter_checks = self._get_factory_checks(checks.factory) - for incubating_check in incubating_checks: - self.assertFalse(incubating_check in adopter_checks) - def test_neutron_lib_factory(self): lib_checks = self._get_factory_checks(checks._neutron_lib_factory) other_checks = self._get_factory_checks(checks.factory) - other_checks.extend(self._get_factory_checks( - checks.incubating_factory)) self.assertTrue(len(lib_checks) > 0) diff --git a/releasenotes/notes/one-hacking-factory-01053e8e3d88c3d5.yaml b/releasenotes/notes/one-hacking-factory-01053e8e3d88c3d5.yaml new file mode 100644 index 000000000..c504f10e2 --- /dev/null +++ b/releasenotes/notes/one-hacking-factory-01053e8e3d88c3d5.yaml @@ -0,0 +1,6 @@ +--- +other: + - The hacking check factory function + ``neutron_lib.hacking.checks.incubating_factory`` has been removed. + All consumers should use ``neutron_lib.hacking.checks.factory`` as per + the ``usage`` dev-ref.