Skip to content

Add pre-commit hook yamllint to standardize YAML files #10974

@jbampton

Description

@jbampton

https://github.com/adrienverge/yamllint

https://yamllint.readthedocs.io/en/stable/

https://yamllint.readthedocs.io/en/stable/integration.html#integration-with-pre-commit

https://yamllint.readthedocs.io/en/stable/rules.html

Example pre-commit config entry:

  - repo: https://github.com/adrienverge/yamllint
    rev: v1.35.1
    hooks:
      - id: yamllint
        name: Run yamllint
        description: Check YAML files with yamllint
        args: [--strict, -c=.github/linters/.yaml-lint.yml]
        exclude: ^mkdocs\.yml$
        types: [yaml]
        files: \.ya?ml$

Example: .github/linters/.yaml-lint.yml

---
# https://yamllint.readthedocs.io/en/stable/
extends: default

rules:
  colons: disable
  comments: disable
  comments-indentation: disable
  document-start: disable
  line-length: disable
  truthy: false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions