YAMLClean YAML Linter

YAML Tabs, Trailing Whitespace and Why CI Rejects Them

YAMLClean Guides · Updated 2026-10-30 · All guides

Tabs

YAML uses indentation for structure, and the specification forbids tab characters in indentation because editors render them at different widths. A parser reports an error at the first line that begins with a tab. A tab often arrives by pasting from a terminal or a wiki, and is invisible in most editors.

The linter reports a tab in indentation as an error with its line number. The cleaner does not convert tabs: replacing a tab with spaces means choosing an indent width, and a wrong choice changes the structure. Fix those lines by hand.

Trailing whitespace

Trailing spaces are legal YAML, but they still cause trouble:

  • Linters configured for it (yamllint has a trailing-spaces rule) fail the build on them.
  • In a plain multi-line scalar, trailing space is trimmed; inside a quoted string it is part of the value. Cleaning a file by hand can change a quoted value.
  • They add noise to diffs.

The home-page cleaner removes trailing whitespace from every line and blank lines from the ends. It does so on every line, including lines inside a block scalar (| or >), where trailing spaces are data. If your file relies on trailing spaces inside a block scalar, do not clean it with this tool.

Missing space after the colon

key:value is not a mapping entry. YAML reads it as one plain string, key:value. The linter flags lines that look like a key glued to its value. It deliberately ignores URLs (http://x) and times (12:30), which contain a colon legitimately.

Developer Sponsor / Partner
Copied to clipboard!