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
This commit is contained in:
Boden R 2017-01-17 13:17:44 -07:00
parent 833ec8c353
commit de568b8a1c
4 changed files with 20 additions and 40 deletions

View File

@ -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
<https://review.openstack.org/389397/>`_ and
watching for announcements. Announcements regarding neutron-lib adopter
hacking checks will be communicated via openstack-dev email list
and `neutron meetings <https://wiki.openstack.org/wiki/Network/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
<https://wiki.openstack.org/wiki/Network/Meetings>`_.
[flake8]
# temporarily ignore N536 while fixing failing checks
ignore = N536

View File

@ -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)

View File

@ -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)

View File

@ -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.