From 3febd1423a0f1f27df54a17057ceb5691c7650ab Mon Sep 17 00:00:00 2001 From: Sorin Sbarnea Date: Sat, 31 Oct 2020 17:44:18 +0000 Subject: [PATCH] Enable progressive mode with ansible-lint Makes use of newer feature which produces failures only when current commit is adding new violations, exiting ones being considered as already known. To prove it works, it also removes the E208 from warn, making it an error. Still, the final linting result is a success because these violations were already present before current commit. Change-Id: Ia858f2a3e71d9634e9d90e890d82714105e8f8c9 --- .ansible-lint | 5 ----- .gitignore | 1 + linters-requirements.txt | 2 +- tox.ini | 3 ++- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 2f74be1a9..aafdf2ab5 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -5,13 +5,8 @@ quiet: false skip_list: - '106' # Role name does not match ``^[a-z][a-z0-9_]+$`` pattern - '204' # Lines should be no longer than 160 chars - # TODO(AJaeger): E208 gives false positives currently, we - # should enable it once all issues in zuul-jobs and - # ansible-lint are fixed. - '301' # Commands should not change things if nothing needs doing - '701' # No 'galaxy_info' found -warn_list: - - '208' # File permissions not mentioned rulesdir: - ./.rules/ use_default_rules: true diff --git a/.gitignore b/.gitignore index b5c8bd993..68592d37d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ doc/build AUTHORS ChangeLog dist +.cache diff --git a/linters-requirements.txt b/linters-requirements.txt index 67af76c76..27e90e3e3 100644 --- a/linters-requirements.txt +++ b/linters-requirements.txt @@ -2,4 +2,4 @@ # conflict, like ansible version required by ansible-lint. flake8 yamllint>=1.23.0 -ansible-lint>=4.3.4,<5 +ansible-lint>=4.3.7,<5 diff --git a/tox.ini b/tox.ini index f9af04466..31b405cac 100644 --- a/tox.ini +++ b/tox.ini @@ -48,7 +48,7 @@ commands = flake8 {posargs} yamllint -s -f parsable . python -m ansiblelint --version - python -m ansiblelint {env:ANSIBLELINT_OPTS:} + python -m ansiblelint {env:ANSIBLELINT_OPTS:--progressive} # Ansible Syntax Check bash -c "find playbooks -type f -regex '.*.ya?ml' ! -regex '.*vars\/.*' -exec \ ansible-playbook --syntax-check -i {toxinidir}/tests/inventory \{\} + > /dev/null" @@ -70,6 +70,7 @@ commands = {posargs} ignore = E124,E125,E129,E252,E402,E741,W503,W504,H show-source = True exclude = + .cache, .venv, .tox, dist,