Validate / lint yaml
yamllint
- GitHub
- Docs
- Configuration
- a file named
.yamllint,.yamllint.yaml, or.yamllint.ymlin the current working directory, or a parent directory (the search for this file is terminated at the user’s home or filesystem root) - a filename referenced by $YAMLLINT_CONFIG_FILE, if set
~/.config/yamllint/config, if present
- a file named
- Disable with comments
- Configuration
- Megalinter integration
- Megalinter looks for a
.yamllint.ymlconfig file
- Megalinter looks for a
- pre-commit hook
Install:
apt install yamllint
Usage:
yamllint hiera/local1.yaml
v8r
A command-line JSON, YAML and TOML validator that uses Schema Store to detect a suitable schema for your input files based on the filename.
- GitHub
- Javascript
- Docs
- Megalinter integration
- No way to exclude files from Megalinter runs ?
- Not available in Arch/AUR, Mason, Mise
Usage:
npx v8r ...
Other linters
or
cat hiera/local1.yaml| shyaml get-values
cat .gitlab-ci.yml| ysh
Sort yaml
https://github.com/ddebin/yaml-sort
npm install -g yaml-sort
Yaml formaters
-
- Go
- Config
- yamlfmt's recent slow development
- very unintrusive in default mode
-
- Python
- Project is in Pull Request maintenance only
- Still recent releases
- Bug: Link with anchor gets split in comment
- Doesn't Crop long lines
- Bug: Re-joins multiline string values even when resulting line is longer
than the
YAMLFIX_LINE_LENGTH