diff --git a/.pylintrc b/.pylintrc index f96576d2..85a916ce 100644 --- a/.pylintrc +++ b/.pylintrc @@ -1,49 +1,85 @@ # The format of this file isn't really documented; just use --generate-rcfile -[MASTER] +[MAIN] # Add to the black list. It should be a base name, not a # path. You may set this option multiple times. ignore=.git,tests +# List of plugins (as comma separated values of python module names) to load, +# usually to register additional checkers. +load-plugins=pylint.extensions.no_self_use + +# When enabled, pylint would attempt to guess common misconfiguration and emit +# user-friendly hints instead of false-positive error messages. +suggestion-mode=yes + [MESSAGES CONTROL] -# TODO: This list is copied from neutron, the options which do not need to be -# suppressed have been already removed, some of the remaining options will be -# removed by code adjustment. +# NOTE(gus): This is a long list. A number of these are important and +# should be re-enabled once the offending code is fixed (or marked +# with a local disable) disable= # "F" Fatal errors that prevent further processing import-error, # "I" Informational noise + c-extension-no-member, + locally-disabled, # "E" Error for important programming issues (likely bugs) + access-member-before-definition, no-member, + no-method-argument, + no-self-argument, + not-an-iterable, # "W" Warnings for stylistic problems or minor programming issues abstract-method, arguments-differ, attribute-defined-outside-init, + bad-indentation, broad-except, dangerous-default-value, + expression-not-assigned, fixme, global-statement, - no-init, + keyword-arg-before-vararg, + literal-comparison, + non-parent-init-called, + not-callable, protected-access, redefined-builtin, redefined-outer-name, signature-differs, + super-init-not-called, + unpacking-non-sequence, unused-argument, unused-import, unused-variable, useless-super-delegation, + unnecessary-pass, + raise-missing-from, + arguments-renamed, + broad-exception-raised, + unspecified-encoding, + redundant-u-string-prefix, + unused-private-member, # "C" Coding convention violations - bad-continuation, + consider-iterating-dictionary, + consider-using-enumerate, invalid-name, len-as-condition, - misplaced-comparison-constant, missing-docstring, + singleton-comparison, superfluous-parens, ungrouped-imports, wrong-import-order, + consider-using-f-string, + consider-using-dict-items, # "R" Refactor recommendations + consider-merging-isinstance, + consider-using-ternary, duplicate-code, + inconsistent-return-statements, no-else-return, no-self-use, + redefined-argument-from-local, + simplifiable-if-statement, too-few-public-methods, too-many-ancestors, too-many-arguments, @@ -51,22 +87,15 @@ disable= too-many-instance-attributes, too-many-lines, too-many-locals, + too-many-nested-blocks, too-many-public-methods, too-many-return-statements, too-many-statements, - inconsistent-return-statements, - useless-object-inheritance, - too-many-nested-blocks, - too-many-boolean-expressions, - not-callable, -# new for python3 version of pylint - chained-comparison, - consider-using-dict-comprehension, - consider-using-in, consider-using-set-comprehension, - unnecessary-pass, - useless-object-inheritance - + useless-object-inheritance, + super-with-arguments, + use-dict-literal, + consider-using-with [BASIC] # Variable names can be 1 to 31 characters long, with lowercase and underscores @@ -79,8 +108,8 @@ argument-rgx=[a-z_][a-z0-9_]{1,30}$ # and be lowercased with underscores method-rgx=([a-z_][a-z0-9_]{2,}|setUp|tearDown)$ -# Module names matching -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ +# Module names matching neutron-* are ok (files in bin/) +module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+)|(neutron-[a-z0-9_-]+))$ # Don't require docstrings on tests. no-docstring-rgx=((__.*__)|([tT]est.*)|setUp|tearDown)$ @@ -92,23 +121,27 @@ max-line-length=79 [VARIABLES] # List of additional names supposed to be defined in builtins. Remember that # you should avoid to define new builtins when possible. -additional-builtins= +# _ is used by our localization +additional-builtins=_ [CLASSES] -# List of interface methods to ignore, separated by a comma. -ignore-iface-methods= +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=cls [IMPORTS] # Deprecated modules which should not be used, separated by a comma deprecated-modules= # should use oslo_serialization.jsonutils - json + json, + six [TYPECHECK] # List of module names for which member attributes should not be checked -ignored-modules=six.moves,_MovedItems +ignored-modules=_MovedItems [REPORTS] # Tells whether to display a full report or only the messages reports=no - diff --git a/requirements.txt b/requirements.txt index bc04634b..778430d3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,6 @@ # Requirements lower bounds listed here are our best effort to keep them up to # date but we do not test them so no guarantee of having them all correct. If # you find any incorrect lower bounds, let us know or propose a fix. - -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - fixtures>=3.0.0 # Apache-2.0/BSD netaddr>=0.7.18 # BSD ovs>=2.10.0 # Apache-2.0 diff --git a/test-requirements.txt b/test-requirements.txt index 749805c3..4b6c133c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,3 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - coverage!=4.4,>=4.0 # Apache-2.0 isort==4.3.21 # MIT python-subunit>=1.0.0 # Apache-2.0/BSD diff --git a/tox.ini b/tox.ini index 05a96301..70891be5 100644 --- a/tox.ini +++ b/tox.ini @@ -18,7 +18,7 @@ deps = -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt - hacking>=3.0.1,<3.1.0 # Apache-2.0 + hacking>=6.1.0,<6.2.0 # Apache-2.0 commands = stestr run --slowest {posargs} [testenv:pep8] @@ -26,7 +26,7 @@ commands = flake8 bash {toxinidir}/tools/coding-checks.sh --all '{posargs}' deps = {[testenv]deps} - pylint==2.5.3 # GPLv2 + pylint==2.17.4 # GPLv2 allowlist_externals = bash [testenv:venv]