Now that we have a single hacking check factory in lib [1], we've followed-up by enhancing the neutron-lib periodic job to include pep8 checks (see depends on patch). This patch makes a few doc clarifications as to the pep8 inclusion in the job. [1] I0a8b39052c0f81f2ecbab3923353be1537b89a65 Change-Id: I035ffa8d34b0ebdabf730e99200739365f041343 Depends-On: I9bb173071abcbc5078a3fd728c41c34bf1b83ca2
2.5 KiB
Usage
To use neutron-lib in a project:
import neutron_lib
Hacking Checks
The neutron_lib.hacking package implements a number of
public hacking
checks intended to help adopters validate their compliance with the
latest hacking standards.
To adopt neutron-lib's hacking checks:
Update your project's
tox.inito useneutron_lib.hacking.checks.factoryfor itslocal-check-factory.For example in your
tox.ini:[hacking] local-check-factory = neutron_lib.hacking.checks.factoryIf your project needs to register additional project specific hacking checks, you can define your own factory function that calls neutron-lib's
factoryfunction.For example in your project's python source:
def my_factory(register): # register neutron-lib checks neutron_lib_checks.factory(register) # register project specific checks register(my_project_check)And use your project's own factory in
tox.ini:[hacking] local-check-factory = myproject.mypkg.my_factoryUpdate your project's
tox.inienable any flake8 extensions neutron-lib'stox.inidoes. These are hacking checks otherwise disabled by default that neutron-lib expects to run.For example in neutron-lib's
tox.ini:[flake8] # H904: Delay string interpolations at logging calls enable-extensions=H904In the example above, adopters should also add
H904to theenable-extensionsin theirtox.ini.Actively adopt neutron-lib hacking checks by running and monitoring the neutron-lib periodic job <http://grafana.openstack.org/dashboard/ db/neutron-lib-failure-rate?panelId=4&fullscreen> (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.
Under certain circumstances, adopters may need to ignore specific neutron-lib hacking checks temporarily. This can be done using the
ignoreproperty in the[flake8]section of yourtox.ini. For example, to ignore the hacking checkN536your tox.ini might have:[flake8] # temporarily ignore N536 while fixing failing checks ignore = N536