This is in line with discussion [1] where translators asked to stop
translating log messages, leaving translations for user visible messages
only.
This patch introduces a new N537 check, and since it is more broad than
N533 while covering all cases of the latter check, N533 is removed.
This patch also cleans up _i18n._L? translation hints since they are
internal and won't be allowed anymore.
[1] http://lists.openstack.org/pipermail/openstack-dev/2017-March/114191.html
Related-Bug: #1674569
Change-Id: I2813587824eac1a996c715b0c4bd36b0c9580d73
This is in line with discussion [1] where translators asked to stop
translating log messages, leaving translations for user visible messages
only.
This patch kills N531 hacking check. A follow up in one of next library
releases will also kill N533, replacing it with a more broad check
forbidding any log translations, not just debug.
We don't squash existing check removal with the patch that adds new
checks because those checks are mutually exclusive, and so with a
squash, we would make it so that consuming projects would not be able to
adopt their code to the coming changes in a non-breaking way.
[1] http://lists.openstack.org/pipermail/openstack-dev/2017-March/114191.html
Change-Id: I5b92dbda79bd45cd1e2f5329ebc046a2dd9b7bff
One should replace assertEqual(None, *) with assertIsNone in tests
that validate that a variable is None.
This is based on commit 33a459c2c309670b0fcb2fcac5d128e802be7a69
Change-Id: I7794934f5c2267125bafb9d9953352daa68c39a7
Neutron recently updated their usage of hacking to use
version 0.12 [1] that now contains the hacking check
check_delayed_string_interpolation who's off_by_default
value is initially True (i.e. disabled). This hacking check
is defined in neutron_lib, but hasn't been registered in our
factory and isn't being consumed directly [2].
This patch takes a simple approach to reusing openstack-dev
hacking checks:
- Removes all traces of neutron-lib's version of the check; no one is
using it [2].
- Bumps our version of hacking to use 0.12 so we can use the checks
in that release.
- Enables the check via enabled extensions in tox.ini as neutron did [1].
- Updates our hacking check usage, noting that adopters should
enable the same extensions we do (via tox.ini).
[1] https://review.openstack.org/#/c/394817/
[2] http://codesearch.openstack.org/?q=check_delayed_string_interpolation&i=nope&files=&repos=
Change-Id: Ie9448317855b9cba6092cd0f63b77d26a562a5c9
String interpolation should be delayed to be handled
by the logging code, rather than being done at the point of
the logging call. So add the following hacking rule for it.
- [N536] String interpolation should be delayed at logging calls.
We need this to ensure that all projects using the neutron-lib
hacking rules still have enforcement of the log policies
of the project.
See the oslo i18n guideline.
* http://docs.openstack.org/developer/oslo.i18n/guidelines.html
Change-Id: I901dcbfbd53d5d19db651473d2891bc8e8a59710
Related-Bug: #1596829
As per [1] we are not allowing eventlet based code in neutron-lib.
This patch adds a hacking check to ensure no eventlet based imports
are brought into neutron-lib. This check is added to the neutron-lib
internal checks as consumers are not likely to forbid eventlet yet.
UTs are also included.
[1] https://review.openstack.org/#/c/333017/
Change-Id: I4a32093a0971750e07f89fff5a1d5c501cf20cdd
Oslo libraries don't ship oslo.* import namespace for a while, so there
is no real need to check against its usage. Since the module is public,
we need to follow deprecation process.
Note that only direct usage of the check is supported. Factory does not
register it anymore.
Change-Id: I48dc1555fd2c77708fd44f3eed4617f636c346de
As per [1], this patch adds a new hacking check that verifies
raised exceptions don't use unlocalized string messages. This
patch also adds unit tests for the new check and enables
checks for neutron-lib itself (as per tox.ini).
Note: Perhaps this check better belongs in openstack-dev/hacking
but it seems we already have a number of more generic checks
in neutron. We can discuss that here need be.
NB: Without [1] this new hacking check fails when running pep8 on
neutron-lib.
[1] https://review.openstack.org/#/c/324374/
Change-Id: Ia13f190ec6843ab360d115871d345c4ddc302cc5
3 hacking rules have been migrated from neutron. The rules are:
[N531] Validate that LOG messages, except debug ones,
have translations
[N532] Validate that LOG.warning is used instead of LOG.warn.
The latter is deprecated.
[N533] Validate that debug level logs are not translated
We need this to ensure that all projects using the neutron-lib
hacking rules still have enforcement of the log translation
policies of the project.
Change-Id: I3d3c6797805e59304e83b9d1bcbfc449080f823a
Starting with the most basic of the neutron rules. The neutron file will
include this one along with its own rules.
Partially-Implements: blueprint neutron-lib
Change-Id: Icda0c959c2ddbd1feada33e326f6c0fb0b23fc6a