Validate / lint yaml
yamllint
- Docs
- Megalinter integration
- Megalinter looks for a
.yamllint.yml
config 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's on your wavelength v8r is a command-line 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
Format/fix yaml
prettier l.yml
prettier --write l.yml
Sort yaml
https://github.com/ddebin/yaml-sort
npm install -g yaml-sort
Yaml formaters
- prettier
- yamlfmt
- yamlfix
- Project is in Pull Request maintenance only
- 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