Enable global hacking checks and removed local checks
In this patchset, I set up 'enabled-extensions' in flake8 section of tox.ini. In newer hacking versions, we can enable some of the non-default hacking rules (one by one), which are disabled by default and implemented in the newer versions of hacking. The enabled extensions are the following: * [H106] Don’t put vim configuration in source files (off by default). * [H203] Use assertIs(Not)None to check for None (off by default). * [H904] Delay string interpolations at logging calls (off by default). Together with enabling these rules, I also removed the locally implemented versions of them. Due to limitations of local checking engine, there were some places in the tests, where pep8 failed. In this patchset, these codes are also fixed. Change-Id: I3a9d2dc007a269cdb2cad441e22f5eb9b58ce0a0
This commit is contained in:
parent
6ccb8c8a00
commit
a5437f3943
@ -21,13 +21,10 @@ Nova Specific Commandments
|
||||
should be moved into a common module
|
||||
- [N313] capitalize help string
|
||||
Config parameter help strings should have a capitalized first letter
|
||||
- [N314] vim configuration should not be kept in source files.
|
||||
- [N316] Change assertTrue(isinstance(A, B)) by optimal assert like
|
||||
assertIsInstance(A, B).
|
||||
- [N317] Change assertEqual(type(A), B) by optimal assert like
|
||||
assertIsInstance(A, B)
|
||||
- [N318] Change assertEqual(A, None) or assertIs(A, None) to optimal assert
|
||||
like assertIsNone(A)
|
||||
- [N319] Validate that debug level logs are not translated.
|
||||
- [N320] Setting CONF.* attributes directly in tests is forbidden. Use
|
||||
self.flags(option=value) instead.
|
||||
@ -64,7 +61,6 @@ Nova Specific Commandments
|
||||
- [N351] Do not use the oslo_policy.policy.Enforcer.enforce() method.
|
||||
- [N352] LOG.warn is deprecated. Enforce use of LOG.warning.
|
||||
- [N353] Validate that context objects is not passed in logging calls.
|
||||
- [N354] String interpolation should be delayed at logging calls.
|
||||
- [N355] Enforce use of assertTrue/assertFalse
|
||||
- [N356] Enforce use of assertIs/assertIsNot
|
||||
- [N357] Use oslo_utils.uuidutils or uuidsentinel(in case of test cases) to
|
||||
|
1
tox.ini
1
tox.ini
@ -161,6 +161,7 @@ commands = bash -c tools/releasenotes_tox.sh
|
||||
#
|
||||
# E251 Skipped due to https://github.com/jcrocholl/pep8/issues/301
|
||||
|
||||
enable-extensions = H106,H203,H904
|
||||
ignore = E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E251,H405
|
||||
exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools/xenserver*,releasenotes
|
||||
# To get a list of functions that are more complex than 25, set max-complexity
|
||||
|
Loading…
Reference in New Issue
Block a user