Add ansible-lint pre-commit hook
Change-Id: I569725e26829acd9512675c9af45b726f2dc84eb
This commit is contained in:
parent
c1378755b1
commit
346939ccb7
@ -34,6 +34,12 @@ repos:
|
||||
pass_filenames: false
|
||||
# args: [--ignore-missing-imports]
|
||||
|
||||
- repo: https://github.com/ansible/ansible-lint.git
|
||||
rev: v4.2.0
|
||||
hooks:
|
||||
- id: ansible-lint
|
||||
files: \.(yaml|yml)$
|
||||
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: pylint
|
||||
|
14
tox.ini
14
tox.ini
@ -96,6 +96,14 @@ commands =
|
||||
pre-commit run -a pylint
|
||||
|
||||
|
||||
[testenv:ansible-lint]
|
||||
basepython = {[testenv:pep8]basepython}
|
||||
deps = {[testenv:pep8]deps}
|
||||
envdir = {toxworkdir}/pep8
|
||||
commands =
|
||||
pre-commit run -a ansible-lint
|
||||
|
||||
|
||||
[testenv:linters]
|
||||
|
||||
basepython = {[testenv:pep8]basepython}
|
||||
@ -105,12 +113,6 @@ envdir = {toxworkdir}/pep8
|
||||
commands =
|
||||
pre-commit run -a
|
||||
pre-commit install
|
||||
# Ansible lint
|
||||
# [ANSIBLE0012] Commands should not change things if nothing needs doing
|
||||
bash -c 'find roles infrared_plugin/roles -maxdepth 1 -mindepth 1 -type d | \
|
||||
xargs -t -n1 -P 16 ansible-lint -xANSIBLE0012'
|
||||
bash -c 'find playbooks infrared_plugin -maxdepth 2 -type f -regex '.*.y[a]ml' | \
|
||||
xargs -t -n1 -P 16 ansible-lint -xANSIBLE0012'
|
||||
|
||||
|
||||
[flake8]
|
||||
|
Loading…
x
Reference in New Issue
Block a user