yamlfmt – format YAML files

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

  • Format individual YAML files or recursively process directories.
  • Formatting, linting and dry-run operating modes.
  • Read YAML from standard input and write formatted output to standard output.
  • Support standard file paths and Doublestar glob patterns.
  • Configurable inclusion, exclusion and file extension rules.
  • Exclude paths using Git ignore files.
  • Automatically discover project-level and global configuration files.
  • Control indentation, line endings, document markers and blank lines.
  • Trim trailing whitespace and ensure files end with a newline.
  • Configure sequence indentation and flow or block sequence styles.
  • Enforce single or double quotation marks around string values.
  • Alternative formatter for producing KYAML output.
  • Display formatting differences and provide appropriate exit codes for automated checks.
  • Support integration with pre-commit hooks and continuous integration pipelines.
  • Extensible library interface for implementing custom formatters.
  • Cross-platform support – runs on Linux, macOS, and Windows.

Website: github.com/google/yamlfmt
Support:
Developer: Google
License: Apache License 2.0

yamlfmt is written in Go. Learn Go with our recommended free books and free tutorials.


Related Software

YAML Code Formatters
yamlfmtExtensible command-line tool and Go library for formatting YAML files
libfyamlFully-featured YAML 1.2 and JSON parser/writer
yamlfixOpinionated YAML formatter
pretty-yamlHuman-readable YAML-serialized data
yamLittle formatter for YAML
Pretty YAMLSemi-tolerant and configurable YAML formatter

Read our verdict in the software roundup.


Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted