Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 1.56 KB

YamlLinting.md

File metadata and controls

34 lines (23 loc) · 1.56 KB

YAML Linting

This workflow uses yamllint for linting YAML files according to a configuration file. Such a configuration file includes a set of rules that are checked against when linting the files and can be found in /.trunk/configs/.yamllint.yaml.

You would typically consume the corresponding GHA workflow for YAML linting like this:

...

jobs:
    yaml-linting:
        name: YAML Linting
        uses: Lombiq/GitHub-Actions/.github/workflows/yaml-lint.yml@dev
        with:
            config-file-path: 'tools/Lombiq.GitHub.Actions/.trunk/configs/.yamllint.yaml'
            search-path: '.'

Where:

  • config-file-path: Specifies the location of the yamllint rules file to use. See more details about such file here.
  • search-path: Where the files to lint should be searched.

Integration with VSCode

During local development, YAML linting can be enabled in VSCode via the Trunk Check extension. Such a tool will look for the yamllint configuration file located in the folder /.trunk, which is already setup.

Additionally, the linter can be run as a standalone tool:

yamllint -c ./.trunk/configs/.yamllint.yaml ./github

Optionally, the Trunk Code extension can be used in conjunction with the YAML by Red Hat extension, which provides IntelliSense and description-on-hover capabilities based on a schema.