yamllint .yamllint Configuration
yamllint is configured by .yamllint (or .yamllint.yaml/.yml), where extends picks a base preset and rules tunes individual checks.
The config decides how strict each rule is and which files to skip. Most projects extend the default preset and relax a few rules.
What it does
yamllint loads .yamllint, .yamllint.yaml, or .yamllint.yml from the working directory. extends inherits a built-in preset (default or relaxed), rules configures each check (with a level of error/warning or disable), and ignore lists glob patterns to skip.
Common usage
extends: default
rules:
line-length:
max: 120
level: warning
document-start: disable
trailing-spaces: enable
ignore: |
vendor/
node_modules/Config keys
| Key | What it does |
|---|---|
| extends | Base preset: default or relaxed |
| rules.<rule> | Configure a rule; enable, disable, or set options |
| rules.<rule>.level | error or warning for that rule |
| rules.line-length.max | Maximum line length (default 80) |
| ignore | Glob patterns of files to skip |
| yaml-files | Filename patterns yamllint treats as YAML |
Common errors in CI
"invalid config: no such rule: X" means a rule name typo or a rule from a newer yamllint. "invalid config: line-length: ..." means a bad option type. The default preset sets line-length.max to 80, which surprises teams with longer lines; raise max or set its level to warning.