Merge "Enable pylint in horizon"

This commit is contained in:
Zuul 2019-01-14 12:47:49 +00:00 committed by Gerrit Code Review
commit 4eac00fccf
4 changed files with 114 additions and 8 deletions

117
.pylintrc
View File

@ -2,15 +2,106 @@
[MASTER] [MASTER]
# Add <file or directory> to the black list. It should be a base name, not a # Add <file or directory> to the black list. It should be a base name, not a
# path. You may set this option multiple times. # path. You may set this option multiple times.
ignore=test ignore=test,tests,tests.py,local_settings.py
[Messages Control] [Messages Control]
# NOTE(justinsb): We might want to have a 2nd strict pylintrc in future disable=
# C0111: Don't require docstrings on every method # "F" Fatal errors that prevent further processing
# W0511: TODOs in code comments are fine. # "I" Informational noise
# W0142: *args and **kwargs are fine. locally-disabled,
# W0622: Redefining id is fine. # "E" Error for important programming issues (likely bugs)
disable=C0111,W0511,W0142,W0622 access-member-before-definition,
assignment-from-no-return,
bad-super-call,
import-error,
logging-too-few-args,
method-hidden,
misplaced-bare-raise,
no-member,
no-name-in-module,
not-an-iterable,
not-callable,
raising-non-exception,
redundant-keyword-arg,
undefined-all-variable,
unexpected-keyword-arg,
# "W" Warnings for stylistic problems or minor programming issues
arguments-differ,
attribute-defined-outside-init,
bad-indentation,
broad-except,
cell-var-from-loop,
dangerous-default-value,
deprecated-method, # TODO
exec-used,
fixme,
keyword-arg-before-vararg, # TODO
logging-not-lazy,
pointless-string-statement,
protected-access,
raising-format-tuple,
redefined-builtin,
redefined-outer-name,
reimported,
signature-differs,
super-init-not-called,
undefined-loop-variable,
unidiomatic-typecheck,
unnecessary-pass,
unused-argument,
unused-import,
unused-wildcard-import,
useless-else-on-loop,
useless-super-delegation,
using-constant-test,
wildcard-import,
# "C" Coding convention violations
abstract-method,
anomalous-backslash-in-string,
bad-builtin,
bad-continuation,
bad-mcs-classmethod-argument,
deprecated-lambda,
expression-not-assigned,
global-statement,
invalid-name,
len-as-condition,
line-too-long,
misplaced-comparison-constant,
missing-docstring,
no-method-argument,
superfluous-parens,
too-many-lines,
try-except-raise,
ungrouped-imports,
unused-variable,
wrong-import-order, # TODO
# "R" Refactor recommendations
chained-comparison,
comparison-with-itself,
consider-using-dict-comprehension,
consider-using-in,
consider-using-set-comprehension,
cyclic-import, # TODO
duplicate-code,
inconsistent-return-statements, # TODO
interface-not-implemented,
no-else-return,
no-self-use,
redefined-argument-from-local,
simplifiable-if-expression,
simplifiable-if-statement,
too-many-ancestors,
too-many-arguments,
too-many-branches,
too-many-function-args,
too-many-instance-attributes,
too-many-locals,
too-many-nested-blocks,
too-many-return-statements,
too-many-statements,
trailing-comma-tuple,
useless-object-inheritance
[Basic] [Basic]
# Variable names can be 1 to 31 characters long, with lowercase and underscores # Variable names can be 1 to 31 characters long, with lowercase and underscores
@ -29,6 +120,10 @@ module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+)|(keystone-[a-z0-9_-]+))$
# Don't require docstrings on tests. # Don't require docstrings on tests.
no-docstring-rgx=((__.*__)|([tT]est.*)|setUp|tearDown)$ no-docstring-rgx=((__.*__)|([tT]est.*)|setUp|tearDown)$
[Format]
# Maximum number of characters on a single line.
max-line-length=80
[Design] [Design]
max-public-methods=100 max-public-methods=100
min-public-methods=0 min-public-methods=0
@ -40,3 +135,11 @@ max-args=6
# you should avoid to define new builtins when possible. # you should avoid to define new builtins when possible.
# _ is used by our localization # _ is used by our localization
additional-builtins=_ additional-builtins=_
[typecheck]
# List of module names for which member attributes should not be checked
ignored-modules=six.moves,_MovedItems
[reports]
# Tells whether to display a full report or only the messages
reports=no

View File

@ -590,7 +590,7 @@ def server_list_paged(request,
search_opts['project_id'] = request.user.tenant_id search_opts['project_id'] = request.user.tenant_id
if search_opts.pop('paginate', False): if search_opts.pop('paginate', False):
reversed_order = sort_dir is "asc" reversed_order = sort_dir == "asc"
LOG.debug("Notify received on deleted server: %r", LOG.debug("Notify received on deleted server: %r",
('server_deleted' in request.session)) ('server_deleted' in request.session))
deleted = request.session.pop('server_deleted', deleted = request.session.pop('server_deleted',

View File

@ -9,6 +9,7 @@
# Hacking should appear first in case something else depends on pep8 # Hacking should appear first in case something else depends on pep8
hacking>=1.1.0 # Apache-2.0 hacking>=1.1.0 # Apache-2.0
# #
astroid==2.1.0;python_version>='3.0' # LGPLv2.1
bandit>=1.4.0 # Apache-2.0 bandit>=1.4.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0
doc8>=0.6.0 # Apache-2.0 doc8>=0.6.0 # Apache-2.0
@ -16,6 +17,7 @@ flake8-import-order==0.12 # LGPLv3
mock>=2.0.0 # BSD mock>=2.0.0 # BSD
mox3>=0.20.0 # Apache-2.0 mox3>=0.20.0 # Apache-2.0
nodeenv>=0.9.4 # BSD nodeenv>=0.9.4 # BSD
pylint==2.2.2;python_version>='3.0' # GPLv2
selenium>=2.50.1 # Apache-2.0 selenium>=2.50.1 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD testscenarios>=0.4 # Apache-2.0/BSD
testtools>=2.2.0 # MIT testtools>=2.2.0 # MIT

View File

@ -65,6 +65,7 @@ commands =
{envpython} {toxinidir}/manage.py extract_messages --verbosity 0 --check-only {envpython} {toxinidir}/manage.py extract_messages --verbosity 0 --check-only
bash {toxinidir}/tools/find_executables.sh bash {toxinidir}/tools/find_executables.sh
doc8 doc/source releasenotes/source releasenotes/notes doc8 doc/source releasenotes/source releasenotes/notes
pylint -j 4 --verbose --rcfile=.pylintrc -f colorized openstack_dashboard openstack_auth horizon
[testenv:cover] [testenv:cover]
basepython = python3 basepython = python3