diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-04-08 09:15:43 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-04-08 09:15:43 +0000 |
commit | a70b3c53484b6555fffb75cf55af931ed3b8449d (patch) | |
tree | 907e5fbf90d44917d961c9033470c773b7eaf31c | |
parent | 65c618aa2b179f69b12a56fb4b960e3c7d864273 (diff) | |
parent | c80c5c4f4cc1f64bc48f02c7e49a67951fd24920 (diff) | |
download | cinder-a70b3c53484b6555fffb75cf55af931ed3b8449d.tar.gz |
Merge "Correct cinder hacking check numbering"
-rw-r--r-- | HACKING.rst | 4 | ||||
-rw-r--r-- | cinder/hacking/checks.py | 48 |
2 files changed, 26 insertions, 26 deletions
diff --git a/HACKING.rst b/HACKING.rst index 066b4eb18..54dcecdb2 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -11,16 +11,16 @@ Cinder Specific Commandments - [N319] Validate that debug level logs are not translated - [N322] Ensure default arguments are not mutable. - [N323] Add check for explicit import of _() to ensure proper translation. -- [N324] Enforce no use of LOG.audit messages. LOG.info should be used instead. - [N327] assert_called_once is not a valid Mock method. - [N328] LOG.info messages require translations `_LI()`. - [N329] LOG.exception and LOG.error messages require translations `_LE()`. - [N330] LOG.warning messages require translations `_LW()`. - [N333] Ensure that oslo namespaces are used for namespaced libraries. -- [N339] Prevent use of deprecated contextlib.nested. - [C301] timeutils.utcnow() from oslo_utils should be used instead of datetime.now(). - [C302] six.text_type should be used instead of unicode - [C303] Ensure that there are no 'print()' statements in code that is being committed. +- [C304] Enforce no use of LOG.audit messages. LOG.info should be used instead. +- [C305] Prevent use of deprecated contextlib.nested. General diff --git a/cinder/hacking/checks.py b/cinder/hacking/checks.py index e33ebf970..d677deb72 100644 --- a/cinder/hacking/checks.py +++ b/cinder/hacking/checks.py @@ -115,19 +115,6 @@ def check_explicit_underscore_import(logical_line, filename): yield(0, "N323: Found use of _() without explicit import of _ !") -def check_no_log_audit(logical_line): - """Ensure that we are not using LOG.audit messages - - Plans are in place going forward as discussed in the following - spec (https://review.openstack.org/#/c/91446/) to take out - LOG.audit messages. Given that audit was a concept invented - for OpenStack we can enforce not using it. - """ - - if no_audit_log.match(logical_line): - yield(0, "N324: Found LOG.audit. Use LOG.info instead.") - - def check_assert_called_once(logical_line, filename): msg = ("N327: assert_called_once is a no-op. please use assert_called_" "once_with to test with explicit parameters or an assertEqual with" @@ -179,15 +166,6 @@ def check_oslo_namespace_imports(logical_line): yield(0, msg) -def check_no_contextlib_nested(logical_line): - msg = ("N339: contextlib.nested is deprecated. With Python 2.7 and later " - "the with-statement supports multiple nested objects. See https://" - "docs.python.org/2/library/contextlib.html#contextlib.nested " - "for more information.") - if no_contextlib_nested.match(logical_line): - yield(0, msg) - - def check_datetime_now(logical_line, noqa): if noqa: return @@ -220,16 +198,38 @@ def check_no_print_statements(logical_line, filename, noqa): yield(0, msg) +def check_no_log_audit(logical_line): + """Ensure that we are not using LOG.audit messages + + Plans are in place going forward as discussed in the following + spec (https://review.openstack.org/#/c/91446/) to take out + LOG.audit messages. Given that audit was a concept invented + for OpenStack we can enforce not using it. + """ + + if no_audit_log.match(logical_line): + yield(0, "C304: Found LOG.audit. Use LOG.info instead.") + + +def check_no_contextlib_nested(logical_line): + msg = ("C305: contextlib.nested is deprecated. With Python 2.7 and later " + "the with-statement supports multiple nested objects. See https://" + "docs.python.org/2/library/contextlib.html#contextlib.nested " + "for more information.") + if no_contextlib_nested.match(logical_line): + yield(0, msg) + + def factory(register): register(no_vi_headers) register(no_translate_debug_logs) register(no_mutable_default_args) register(check_explicit_underscore_import) - register(check_no_log_audit) register(check_assert_called_once) register(check_oslo_namespace_imports) - register(check_no_contextlib_nested) register(check_datetime_now) register(validate_log_translations) register(check_unicode_usage) register(check_no_print_statements) + register(check_no_log_audit) + register(check_no_contextlib_nested) |