Lint directory instead of files and match exclude from oooq-extra.

Linting the directory leads to different result, with a lot more
errors caught.

As a corollary adjust the lint exclude list to match the oooq extra
exclude list.

Change-Id: I4846fb4f4bda29d991e4e36de38dc10f02bcd4ed
Related-Bug: #1764454
(cherry picked from commit 3693144631)
This commit is contained in:
Sofer Athlan-Guyot 2018-04-16 19:23:58 +02:00 committed by Athlan-Guyot sofer
parent 9e67560f90
commit 012c222182
1 changed files with 10 additions and 22 deletions

View File

@ -2,31 +2,19 @@
# ANSIBLE0006: Using command rather than module
# we have a few use cases where we need to use curl and rsync
# ANSIBLE0007: Using command rather than an argument to e.g file
# we have a lot of 'rm' command and we should use file module instead
# ANSIBLE0010: Package installs should not use latest.
# Sometimes we need to update some packages.
# ANSIBLE0011: Skip those unamed tasks
# ANSIBLE0012: Commands should not change things if nothing needs doing
# ANSIBLE0013: Use Shell only when shell functionality is required
# ANSIBLE0016: Tasks that run when changed should likely be handlers
# this requires refactoring roles, skipping for now
# ANSIBLE0012: Commands should not change things if nothing needs doing
# this requires refactoring roles, skipping for now
SKIPLIST="ANSIBLE0006,ANSIBLE0016,ANSIBLE0012"
SKIPLIST="ANSIBLE0006,ANSIBLE0007,ANSIBLE0010,ANSIBLE0012,ANSIBLE0013,ANSIBLE0016"
# lint the playbooks separately to avoid linting the roles multiple times
for DIR in tasks playbooks; do
if [ -d "$DIR" ]; then
pushd $DIR
for playbook in `find . -type f -regex '.*\.y[a]?ml'`; do
ansible-lint -vvv -x $SKIPLIST $playbook || lint_error=1
done
popd
fi
done
# lint all the possible roles
# Due to https://github.com/willthames/ansible-lint/issues/210, the roles
# directories need to contain a trailing slash at the end of the path.
if [ -d ./roles ]; then
for rolesdir in `find ./roles -maxdepth 1 -type d`; do
ansible-lint -vvv -x $SKIPLIST $rolesdir/ || lint_error=1
done
fi
# Lin the role.
ansible-lint -vvv -x $SKIPLIST ./ || lint_error=1
# exit with 1 if we had a least an error or warning.
if [[ -n "$lint_error" ]]; then