Formatters · 5 tools
Top 5 formatting and linting tools for shell scripts and infrastructure config files
For infrastructure repos, start with shfmt for shell scripts, then look at dprint for a single CLI across the surrounding config files and Prettier for a general-purpose style. The list also includes yamllint and ShellCheck, which are linters rather than formatters, for YAML and shell correctness. It is for DevOps and platform engineers who want consistent scripts and config in one repo.
| # | Tool | Best for | Key feature | Platforms / deployment | Pricing | More |
|---|---|---|---|---|---|---|
| 1 | shfmtmvdan | Formatting shell scripts consistently across a team | Documented default style for shell programs | Packages available across many operating systems and package managers; written in pure Go | See vendor pricing page | Introduction |
| 2 | dprintdprint | Config and documentation files around the scripts | Official plugins for Dockerfile, JSON, Markdown, TOML, SQL, TypeScript/JavaScript and Jupyter notebooks | Single static binary with no runtime dependencies; install via shell script, PowerShell, npm, Homebrew or Cargo | See vendor pricing page | Introduction |
| 3 | PrettierPrettier | Teams that want a fully automatic style guide | Formats on save with editor integration | Integrates with most editors; operating systems not stated on the official page | See vendor pricing page | Introduction |
| 4 | yamllintyamllint | Catching YAML mistakes in infrastructure config | Checks key repetition, line length, trailing spaces and indentation | Installable with pip; packaged for all major operating systems | See vendor pricing page | Introduction |
| 5 | ShellCheckShellCheck | Finding bugs and quoting issues in shell scripts | Detects many kinds of quoting issues | Installable with several package managers; packaged for many distros; written in Haskell | See vendor pricing page | Introduction |
1 shfmt
By mvdan
shfmt is a shell script formatter from the mvdan/sh project, which also provides a shell parser and interpreter supporting POSIX Shell, Bash, Zsh and mksh.
Why it is here: It is first because it is built specifically for shell programs, the core file type in this use case.
- Best for
- Formatting shell scripts consistently across a team
- Key features
- Documented default style for shell programs
- Supports POSIX Shell, Bash, Zsh and mksh
- Release tags published as Docker images
- Editor integrations that wrap shfmt exist
- sh-checker GitHub Action performs static analysis using shfmt
- Limits
- Formatting cannot be disabled for ranges of lines, and the project deliberately limits the number of options. It is documented for shell only, so YAML and other config formats need another tool.
- Platforms / deployment
- Packages available across many operating systems and package managers; written in pure Go
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
Official website (github.com/mvdan/sh) · Read our introduction to shfmt
2 dprint
By dprint
dprint is a pluggable, configurable code formatting platform written in Rust that formats many languages through one CLI. It aims to be a single formatting tool for every language in a repository.
Why it is here: It follows shfmt because its documented official plugins cover infrastructure-adjacent files such as Dockerfile, JSON, TOML, Markdown and SQL.
- Best for
- Config and documentation files around the scripts
- Key features
- Official plugins for Dockerfile, JSON, Markdown, TOML, SQL, TypeScript/JavaScript and Jupyter notebooks
- Exec plugin can wrap any other CLI formatter
- dprint init scaffolds a dprint.json configuration file
- dprint check verifies that code is already formatted
- Wasm plugins run sandboxed, without network or file system access
- Limits
- YAML is not among the official plugins named on its page, so teams formatting YAML should check the vendor documentation or community plugins. Shell formatting would go through its Exec plugin wrapping another formatter.
- Platforms / deployment
- Single static binary with no runtime dependencies; install via shell script, PowerShell, npm, Homebrew or Cargo
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
Official website (dprint.dev) · Read our introduction to dprint
3 Prettier
By Prettier
Prettier is an opinionated code formatter that integrates with most editors and automatically enforces a consistent code style.
Why it is here: It sits after dprint as a general-purpose option, useful where a team wants an automatic style guide that removes style discussions from code review.
- Best for
- Teams that want a fully automatic style guide
- Key features
- Formats on save with editor integration
- Can run in pre-commit scripts or githooks
- Can clean up an existing inconsistent codebase quickly
- Aims to use the least controversial coding styles
- Online try-it option exists
- Limits
- Its official page is oriented to JavaScript developers and does not list shell or infrastructure config formats. Teams should check the vendor documentation for the file types they use.
- Platforms / deployment
- Integrates with most editors; operating systems not stated on the official page
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
Official website (prettier.io) · Read our introduction to Prettier
4 yamllint
By yamllint
yamllint is a linter for YAML files that checks syntax validity as well as quirks and cosmetic problems.
Why it is here: It comes fourth because it targets YAML, a common infrastructure config format, though it reports problems rather than rewriting files.
- Best for
- Catching YAML mistakes in infrastructure config
- Key features
- Checks key repetition, line length, trailing spaces and indentation
- Pre-defined configurations such as 'relaxed'
- Custom configs can extend a default config and set rule levels or disable rules
- Special comments disable checks for a line or a block
- Parsable output format for editor syntax checking
- Limits
- It is a linter, not a formatter, and is documented for YAML only. Teams that also need automatic rewriting should check the vendor documentation or pair it with a formatter.
- Platforms / deployment
- Installable with pip; packaged for all major operating systems
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
Official website (github.com/adrienverge/yamllint) · Read our introduction to yamllint
5 ShellCheck
By ShellCheck
ShellCheck is an open source static analysis tool that automatically finds bugs in shell scripts.
Why it is here: It is last because it complements a formatter by finding bugs in shell scripts instead of formatting them.
- Best for
- Finding bugs and quoting issues in shell scripts
- Key features
- Detects many kinds of quoting issues
- Detects higher-level semantic problems
- Warns about portability problems when the shebang says sh
- Integrated linter support in major editors
- Available in CodeClimate, Codacy and CodeFactor for GitHub repositories
- Limits
- It is a static analysis tool, not a formatter, and is documented for shell scripts only. It does not cover YAML or other config files.
- Platforms / deployment
- Installable with several package managers; packaged for many distros; written in Haskell
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
Official website (shellcheck.net) · Read our introduction to ShellCheck
How we chose these tools
We looked at fit with the use case of formatting shell scripts and the config files around them, the capabilities each vendor documents, and what the official pages say about installation and platforms. Tools closest to shell and infrastructure file formats come first. We note where a tool is a linter and not a formatter so the list is read accurately.
All facts come from official vendor pages, with check dates recorded. The order reflects editorial fit for this use case, and we explain each position in words. The list is built from documentation, not product trials, so where a vendor does not state something we say so and point you to the vendor documentation.
Order used in this guide: Ordered by closeness to shell and infrastructure file formats, with general-purpose formatters last.
Frequently asked questions
What is the difference between shfmt and ShellCheck?
shfmt formats shell programs using a documented default style. ShellCheck is a static analysis tool that finds bugs, such as quoting issues and portability problems, in shell scripts.
Does shfmt support Bash and other shells?
Yes. The mvdan/sh project documents support for POSIX Shell, Bash, Zsh and mksh.
Can yamllint reformat my YAML files?
No. yamllint is a linter that checks syntax and issues such as line length, trailing spaces and indentation. Check the vendor documentation if you also need automatic reformatting.
Can one tool format shell scripts and config files?
dprint aims to be a single formatting tool for every language in a repository, and its Exec plugin can wrap any other CLI formatter, such as one for shell. Its official plugins cover Dockerfile, JSON, Markdown, TOML and SQL, among others.
How do I run these tools automatically in CI or on commit?
shfmt has a Docker image and the sh-checker GitHub Action. Prettier can run in pre-commit scripts or githooks, and dprint check verifies that code is already formatted.
- shfmt: github.com/mvdan/sh, github.com/about, github.com/features — checked 21 November 2026
- dprint: dprint.dev, dprint.dev/overview — checked 21 November 2026
- Prettier: prettier.io, prettier.io/docs/why-prettier — checked 21 November 2026
- yamllint: github.com/adrienverge/yamllint, github.com/about, github.com/features — checked 21 November 2026
- ShellCheck: shellcheck.net — checked 21 November 2026
Linthelm is independent and not affiliated with the vendors listed. No vendor paid for inclusion or position. Product names belong to their owners. Features and prices change; confirm details on each official website.