mirror of
https://github.com/linux-system-roles/network.git
synced 2026-01-23 02:15:17 +00:00
Add pylint wrapper
Add run_pylint.py that probe working directory for python source files and pass them to pylint. This is needed because pylint expects module or package, so passing a directory with no __init__.py in it makes pylint angry. With this change, LSR_PYLINT_DIRS is no longer needed. Additionally, we no longer need: - init-hook in pylintrc - [pylintrc] section in tox.ini, because the configuration from this section is now the part of pylintrc - [pycodestyle] section in tox.ini, because pycodestyle linter is not used
This commit is contained in:
parent
f5bc42632d
commit
f21d01ab68
4 changed files with 149 additions and 21 deletions
18
tox.ini
18
tox.ini
|
|
@ -106,23 +106,16 @@ deps =
|
|||
commands =
|
||||
black --check --diff --include "^[^.].*\.py$" --exclude "/(\.[^.].*|tests/roles)/" .
|
||||
|
||||
# Custom role settings may set LSR_PYLINT_DIRS environment variable if there is
|
||||
# a reason to have other than default directories (library/ module_utils/ and
|
||||
# tests/). For example, network role should have this set like
|
||||
#
|
||||
# LSR_PYLINT_DIRS="library/network_connections.py module_utils/network_lsr tests/unit/test_network_connections.py"
|
||||
#
|
||||
[testenv:pylint]
|
||||
basepython = python2.7
|
||||
setenv =
|
||||
{[base]setenv}
|
||||
deps =
|
||||
colorama
|
||||
pylint>=1.8.4
|
||||
ansible
|
||||
commands =
|
||||
pylint --errors-only \
|
||||
{posargs} \
|
||||
{env:LSR_PYLINT_DIRS:library module_utils tests}
|
||||
{envpython} ./run_pylint.py --errors-only {posargs}
|
||||
|
||||
[testenv:flake8]
|
||||
basepython = python2.7
|
||||
|
|
@ -223,13 +216,6 @@ show_source = true
|
|||
max-line-length = 88
|
||||
ignore = E402,W503
|
||||
|
||||
[pylint]
|
||||
max-line-length = 88
|
||||
disable = wrong-import-position
|
||||
|
||||
[pycodestyle]
|
||||
max-line-length = 88
|
||||
|
||||
[travis]
|
||||
python =
|
||||
2.6: py26,extra
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue