yamltidy is a formatter/tidier for YAML files.
Currently it can:
Plans for the future:
- Adjust indentation
- Trim trailing spaces
- Add or remove header
--- and footer
- Enforce quoting style (currently only for single line scalars in block mode)
It can be configured via a YAML config file, similar to yamllint.
- Align mapping values
- Format anchors and tags to be on the same line as the parent node
- Reformat flow collections
What it can't do:
- Fix invalid YAML
- Align comments if it's not clear where they belong to.
Examples for a large number of input files can be found here: