Add pylint pre-commit hook

Change-Id: Id933664460ef15dc2c8a968309de232626aeb5b9
This commit is contained in:
Federico Ressi 2020-07-03 08:01:53 +02:00
parent 7b22fc3468
commit c1378755b1
3 changed files with 12 additions and 5 deletions

View File

@ -34,6 +34,15 @@ repos:
pass_filenames: false pass_filenames: false
# args: [--ignore-missing-imports] # args: [--ignore-missing-imports]
- repo: local
hooks:
- id: pylint
files: ^tobiko/
name: pylint
entry: pylint -j0 --max-line-length=80 -E -e W,E -d unused-import,broad-except,fixme
language: system
types: [python]
# - repo: https://github.com/adrienverge/yamllint.git # - repo: https://github.com/adrienverge/yamllint.git
# rev: v1.23.0 # rev: v1.23.0

View File

@ -2,4 +2,4 @@
ansible-lint==4.2.0 # MIT ansible-lint==4.2.0 # MIT
pre-commit >= 2.6.0 # MIT pre-commit >= 2.6.0 # MIT
pylint>=2.5.2 # GPLv2 pylint>=2.5.2 # GPLv2

View File

@ -93,8 +93,7 @@ basepython = {[testenv:pep8]basepython}
deps = {[testenv:pep8]deps} deps = {[testenv:pep8]deps}
envdir = {toxworkdir}/pep8 envdir = {toxworkdir}/pep8
commands = commands =
pylint -j0 --max-line-length=80 -E -e W,E \ pre-commit run -a pylint
-d unused-import,broad-except,fixme tobiko
[testenv:linters] [testenv:linters]
@ -112,8 +111,6 @@ commands =
xargs -t -n1 -P 16 ansible-lint -xANSIBLE0012' xargs -t -n1 -P 16 ansible-lint -xANSIBLE0012'
bash -c 'find playbooks infrared_plugin -maxdepth 2 -type f -regex '.*.y[a]ml' | \ bash -c 'find playbooks infrared_plugin -maxdepth 2 -type f -regex '.*.y[a]ml' | \
xargs -t -n1 -P 16 ansible-lint -xANSIBLE0012' xargs -t -n1 -P 16 ansible-lint -xANSIBLE0012'
pylint -j0 --max-line-length=80 -E -e W,E \
-d unused-import,broad-except,fixme tobiko
[flake8] [flake8]
@ -130,6 +127,7 @@ application-import-names = tobiko
max-complexity = 10 max-complexity = 10
import-order-style = pep8 import-order-style = pep8
# --- integration test environments ------------------------------------------ # --- integration test environments ------------------------------------------
[integration] [integration]