Yamllint: Difference between revisions

From Omnia
Jump to navigation Jump to search
(Created page with "== yamllint == Install: apt install yamllint Use: yamllint file.yaml Note: * Defaults to max lines 80 limit Doc: https://yamllint.readthedocs.io/en/stable/ == yaml == See yaml")
 
Line 12: Line 12:
Doc:
Doc:
  https://yamllint.readthedocs.io/en/stable/
  https://yamllint.readthedocs.io/en/stable/
== default configuration ==
See https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration
.yamllint
Default:
<pre>
---
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
</pre>
Extending to disable comments indentation:
<pre>
# 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
</pre>
Extending to extend line length:
<pre>
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
</pre>


== yaml ==
== yaml ==


See [[yaml]]
See [[yaml]]

Revision as of 20:11, 25 February 2024

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