If you work with Helm, you know the pain: Go-template directives scattered across YAML files with no consistent indentation. Standard YAML formatters can't help — they don't understand Go templates. And gofmt doesn't know about YAML.
helmfmt fills this gap.
What It Does
helmfmt creates consistent formatting for Helm templates. It auto-aligns Go-template indentation for control blocks (e.g., {{ if ... }}, {{ range ... }}), variables, and comments, improving readability.
Importantly, it does not affect raw YAML structure, keeping your chart valid while making it cleaner.
What Gets Formatted
The tool handles indentation for control blocks (range, with, define, block), branching (if, else, else if, end), variables ({{ $var := ... }}), and some functions like fail, printf, etc. Comments ({{/* ... */}}) are also covered.
Flexible Configuration
helmfmt can be configured using a .helmfmt file in JSON format, where you can tweak indent size, file extensions, and toggle indentation rules per function.
Fits Your Workflow
It can be configured for Zed IDE, VS Code, VIM, and as a pre-commit hook — so it integrates naturally into whatever setup you already have.
Why Bother?
Helm templates are notoriously hard to read. As charts grow, unformatted Go-template logic becomes a maintenance nightmare. helmfmt is a small, opinionated tool that solves exactly this problem — think gofmt, but for Helm charts.
github.com/digitalstudium/helmfmt
Top comments (0)