yamlfmt is an extensible command-line tool and Go library for formatting YAML files.
It produces consistent output using an opinionated formatter while offering numerous options for adjusting the resulting style.
The utility can process individual files, recursively scan directories, accept glob patterns or read YAML from standard input. Its lint and dry-run modes make it suitable for pre-commit checks and continuous integration pipelines.
This is free and open source software.
Key Features
- Formats individual YAML files or recursively processes directories.
- Offers formatting, linting and dry-run operating modes.
- Reads YAML from standard input and writes the result to standard output.
- Supports standard paths and Doublestar glob patterns.
- Provides configurable include, exclude and file extension rules.
- Can exclude paths using a Git ignore file.
- Automatically discovers project-level and global configuration files.
- Controls indentation, line endings, document markers and blank lines.
- Can trim trailing whitespace and ensure files end with a newline.
- Supports configurable array indentation and flow or block array styles.
- Can enforce single or double quotation marks.
- Offers an alternative formatter for producing KYAML output.
- Provides lint-friendly output and exit codes for CI/CD pipelines.
- Can be installed as a pre-commit hook or run from a container image.
- Distributed as a self-contained binary without runtime dependencies.
- Can be embedded as a Go library or extended with custom formatters.
Website: github.com/google/yamlfmt
Support:
Developer: Google
License: Apache-2.0
yamlfmt is written in Go. Learn Go with our recommended free books and free tutorials.
Related Software
| YAML Code Formatters | |
|---|---|
| libfyaml | Fully-featured YAML 1.2 and JSON parser/writer |
| yam | Little formatter for YAML |
| pretty-yaml | Human-readable YAML-serialized data |
Read our verdict in the software roundup.
Explore our comprehensive directory of recommended free and open source software. Our carefully curated collection spans every major software category.This directory is part of our ongoing series of informative articles for Linux enthusiasts. It features hundreds of detailed reviews, along with open source alternatives to proprietary solutions from major corporations such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. You’ll also find interesting projects to try, hardware coverage, free programming books and tutorials, and much more. Discovered a useful open source Linux program that we haven’t covered yet? Let us know by completing this form. |

