Files
ansible-freeipa/utils/lint_check.sh
Rafael Guterres Jeffman 3534fcdce7 ansible-lint: Use the same command line as galaxy-importer
Currently, there is a hard coded timeout in galaxy-importer that
prevents larger collections to execute the ansible-lint step [1].

This patch modifies the calls to ansible-lint on development tools and
upstream CI to use the same arguments as galaxy-importer and disables
the execution of the ansible-lint step for the Ansible's sanity test.

Requested ansible-lint version for tools is also updated, as a more
recent one is required.

This change will not allow development using an environment using Python
2.7, due to newer ansible-lint requirements. Roles and modules tests
against target nodes using Python 2.7 is still possible.

[1]: https://github.com/ansible/galaxy-importer/pull/231
2023-09-05 14:10:09 -03:00

44 lines
1.2 KiB
Bash
Executable File

#!/bin/bash -eu
INFO="\033[37;1m"
WARN="\033[33;1m"
RST="\033[0m"
topdir=$(dirname "$0")
pushd "${topdir}/.." >/dev/null 2>&1 || exit 1
echo -e "${INFO}Running 'flake8'...${RST}"
flake8 plugins utils roles setup.py
echo -e "${INFO}Running 'pydocstyle'...${RST}"
pydocstyle plugins utils roles setup.py
echo -e "${INFO}Running 'pylint'...${RST}"
pylint plugins roles setup.py
ANSIBLE_LIBRARY="${ANSIBLE_LIBRARY:-plugins/modules}"
ANSIBLE_MODULE_UTILS="${ANSIBLE_MODULE_UTILS:-plugins/module_utils}"
ANSIBLE_DOC_FRAGMENT_PLUGINS="${ANSIBLE_DOC_FRAGMENT_PLUGINS:-plugins/doc_fragments}"
export ANSIBLE_LIBRARY ANSIBLE_MODULE_UTILS ANSIBLE_DOC_FRAGMENT_PLUGINS
echo -e "${WARN}Missing file warnings are expected and can be ignored.${RST}"
echo -e "${INFO}Running 'ansible-lint'...${RST}"
playbook_dirs=(
"tests"
"playbooks"
)
ansible-lint --offline --profile production --exclude tests/integration/ --exclude tests/unit/ --parseable --force-color "${playbook_dirs[@]}"
echo -e "${INFO}Running 'ansible-doc-test'...${RST}"
python "${topdir}/ansible-doc-test" -v roles plugins
echo -e "${INFO}Running 'yamllint'...${RST}"
yaml_dirs=(
"tests"
"playbooks"
"molecule"
"roles"
)
yamllint -f colored "${yaml_dirs[@]}"
popd >/dev/null 2>&1 || exit 1