reanahub / reana

REANA: Reusable research data analysis platform
https://docs.reana.io
MIT License
123 stars 54 forks source link

ci: introduce `yamllint` checks #836

Open tiborsimko opened 1 week ago

tiborsimko commented 1 week ago

It would be useful to enrich our CI check suite in order to validate YAML files.

We are using YAML in Helm charts, in REANA demo examples, but also in all the repositories with respect to commitlint.

In our deployment repository (using GitLab), we do:

(1) In GitLab CI:

lint-yamllint:
  image: registry.gitlab.com/pipeline-components/yamllint:latest
  script:
    - ./run-tests.sh --check-yamllint

(2) In run-tests.sh:

...

check_yamllint () {
    yamllint .
}

check_all () {
    check_black
    check_flake8
    check_pydocstyle
    check_shellcheck
    check_yamllint
}

for arg in "$@"
do
    case $arg in
        --check-black) check_black;;
        --check-flake8) check_flake8;;
        --check-pydocstyle) check_pydocstyle;;
        --check-shellcheck) check_shellcheck;;
        --check-yamllint) check_yamllint;;
        *) echo "invalid argument $arg" && exit 2;;
    esac
done

(3) We have the following .yamllint.yaml configuration file so that starting "---" is optional:

extends: default

rules:
  document-start: disable
  line-length: disable

The goal of this issue is to introduce yamllint in a similar way to all our GitHub repositories. This will consist of:

tiborsimko commented 1 week ago

... and, when we are at enriching CI for all repositories, we could also introduce in the same PR set:

I'll try to add some examples for the Markdown linting configuration and for the editor configuration later on.