From 9dec5164679440bc37049cfaf0e614898d1aae84 Mon Sep 17 00:00:00 2001 From: emil Date: Sat, 2 Mar 2024 01:37:00 +0000 Subject: [PATCH] i-3 Introduce a new task to automate linting from command line (#14) Co-authored-by: emo Reviewed-on: https://git.theliberatededge.org/the-liberated-edge/test_linux_containers/pulls/14 --- README.md | 11 +++++++++-- Taskfile.yml | 6 ++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 013b25b..8447005 100644 --- a/README.md +++ b/README.md @@ -170,15 +170,22 @@ cd test_linux_containers Lint all YAML documents. ``` -yamllint . +task lint-yml ``` +Note that this task will trigger formatting of all YAML documents +in the repository as a prerequisite to linting. + Use `ansible-lint` to verify good practices relevant to Ansible. ``` -LC_ALL=C.UTF-8 ansible-lint . +task lint-ansible ``` +Note that this task depends on `lint-yml`, which means that linting YML will +happen before linting the Ansible code base. Linting the Ansible code base will +only be triggered when linting all YML documents in the repository has been successful. + ## YAML code formatting Navigate to the root folder of the local copy of this git repository. diff --git a/Taskfile.yml b/Taskfile.yml index a97c0ed..12e2671 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -3,3 +3,9 @@ version: '3' tasks: format-yml: cmds: [yamlfix .] + lint-yml: + deps: [format-yml] + cmds: [yamllint .] + lint-ansible: + deps: [lint-yml] + cmds: [LC_ALL=C.UTF-8 ansible-lint .]