Rework tox -e linters

Move our syntax-check to be first, logic being if we have bad syntax
and ansible-lint will most likely fail.

Clean our redirects to only output failures. It would be nice is
ansible-playbook / ansible-lint could use the same redirects, but
sadly they cannot.

Change-Id: Ia3c5966d60d28b81e2f2c6a446116bb37df6ab23
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger
2017-07-18 10:48:54 -04:00
parent 8826f3afd9
commit 74d237a3f7

10
tox.ini
View File

@@ -26,14 +26,14 @@ setenv =
whitelist_externals = bash whitelist_externals = bash
commands = commands =
flake8 {posargs} flake8 {posargs}
# Ansible Syntax Check
bash -c "find playbooks -type f -regex '.*.y[a]?ml' -print0 | xargs -n1 -0 \
ansible-playbook --syntax-check -i tests/inventory 1>/dev/null"
# Ansible Lint Check # Ansible Lint Check
# NOTE(pabelanger): Ignore the following checks: # NOTE(pabelanger): Ignore the following checks:
# ANSIBlE0012: Commands should not change things if nothing needs doing # ANSIBlE0012: Commands should not change things if nothing needs doing
bash -c "cd playbooks; find . -type f -regex '.*.y[a]?ml' -print0 | xargs -t -n1 -0 \ bash -c "find playbooks -type f -regex '.*.y[a]?ml' -print0 | xargs -n1 -0 \
ansible-lint -x ANSIBLE0012" ansible-lint -x ANSIBLE0012 2> /dev/null"
# Ansible Syntax Check
bash -c "find playbooks -type f -regex '.*.y[a]?ml' -print | xargs -t -n1 \
ansible-playbook --syntax-check -i tests/inventory > /dev/null"
[testenv:venv] [testenv:venv]
commands = {posargs} commands = {posargs}