Merge "Use a single hacking check factory"

This commit is contained in:
Jenkins
2017-03-04 02:33:56 +00:00
committed by Gerrit Code Review
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.