Yamllint

From Omnia
Revision as of 20:11, 25 February 2024 by Kenneth (talk | contribs) (→‎yamllint)
Jump to navigation Jump to search

yamllint

Install:

apt install yamllint

Use:

yamllint file.yaml

Note:

  • Defaults to max lines 80 limit

Doc:

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

default configuration

See https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration

.yamllint

Default:

---

yaml-files:
  - '*.yaml'
  - '*.yml'
  - '.yamllint'

rules:
  anchors: enable
  braces: enable
  brackets: enable
  colons: enable
  commas: enable
  comments:
    level: warning
  comments-indentation:
    level: warning
  document-end: disable
  document-start:
    level: warning
  empty-lines: enable
  empty-values: disable
  float-values: disable
  hyphens: enable
  indentation: enable
  key-duplicates: enable
  key-ordering: disable
  line-length: enable
  new-line-at-end-of-file: enable
  new-lines: enable
  octal-values: disable
  quoted-strings: disable
  trailing-spaces: enable
  truthy:
    level: warning

Extending to disable comments indentation:

# This is my first, very own configuration file for yamllint!
# It extends the default conf by adjusting some options.

extends: default

rules:
  comments-indentation: disable  # don't bother me with this rule

Extending to extend line length:

extends: default

rules:
  # 80 chars should be enough, but don't fail if a line is longer
  line-length:
    max: 80
    level: warning

  # accept both     key:
  #                   - item
  #
  # and             key:
  #                 - item
  indentation:
    indent-sequences: whatever

yaml

See yaml