Skip to content

Yamllint Coding Style Validation for .gitlab-ci.yml

Adopting Yamllint as Yaml Style Guidelines for .gitlab-ci.yml

It would seem that it would be useful to use Yamllint (https://yamllint.readthedocs.io/) for processing .gitlab-ci.yml files to ensure consistency across projects (I already use for linting yaml in other projects and linting yaml for Ansible).

It is a relatively straightforward inclusion to existing CI processes:

yaml-lint:
  image: sdesbure/yamllint:latest
  script:
    - yamllint .

Therefore, you would gain consistency and overall awareness of linting of yaml files. At the moment, I see that the document-start rules are not followed inside the templates? And I can see a number of inconsistencies with indentation also.

If you want to maintain separate rules for internal projects (maybe extending line-length) then that can easily be done, but seeing as so much yaml is written it may be nice to include expectations for how yaml is styled.

cc @ayufan @nolith /label ci-build /label ~Documentation /label ~"continuous integration"

Edited by Will Hall