Cadmeo

YAML Linter

Structural checks only. This is not a full schema validator.

8
Lines
3
Issues found
3
Lines affected
3 issues
line 3No space after the colon. "key:value" is one scalar, not a mapping.
line 6List item needs a space after the hyphen.
line 7Unquoted value contains a colon followed by a space, which starts a new mapping. Quote the value.

The YAML linter checks the structural mistakes that actually break configuration files: tab indentation, a missing space after a colon, an unquoted value containing a colon, unbalanced quotes and misaligned blocks. It reports the line number for each. It is a structural check, not a schema validator.

How it works

  • Tabs: YAML forbids them for indentation entirely. An editor set to insert tabs produces files that fail to parse with a confusing message.
  • Missing space after a colon: "key:value" is a single scalar string, not a mapping. This one fails silently in the worst way, producing valid YAML that means something else.
  • Unquoted colon in a value: "motto: it is: complicated" starts a nested mapping instead of holding a string.
  • Odd indentation and level jumps, both of which usually mean a block has been pasted at the wrong depth.
  • Unbalanced double quotes on a line.

A file passing every check here can still be wrong for the application reading it. Structural validity says the parser will accept it, not that the keys and values are the ones your tool expects.

Examples

Missing space after a colon

Line

  port:8080

Result

Flagged: "key:value" is one scalar, not a mapping

This parses successfully as the string "port:8080" rather than a port key. It is the most dangerous YAML mistake precisely because nothing errors.

A colon inside a value

Line

  motto: it is: complicated

Result

Flagged: quote the value

The second colon starts a nested mapping. Quoting the value, "it is: complicated", is the fix.

A list item without a space

Line

    -api

Result

Flagged: list item needs a space after the hyphen

Without the space this is the scalar "-api" rather than a list entry, so the list silently gains a string where an item was intended.

Frequently asked questions

Why does YAML forbid tabs?

Because a tab has no defined width, so the same file would have different structure depending on the editor. The specification bans them outright for indentation. Configure your editor to insert spaces in .yml and .yaml files and the problem disappears permanently.

Why is a missing space after a colon so dangerous?

Because it does not error. "port:8080" is perfectly valid YAML (it is a string, not a mapping) so the file parses and your application simply does not find the key it expected. It is the mistake most likely to reach production.

Does passing this mean my YAML is correct?

It means the structure is sound and a parser will accept it. It says nothing about whether the keys are the ones your application needs or the values are valid. For that you need schema validation against the specific tool consuming the file.

Why not use a real YAML parser?

A parser tells you where it gave up, which is often several lines after the actual mistake and phrased in terms of tokens. These checks name the specific problem on the specific line, which is more useful for the handful of mistakes that cause most YAML failures.

Compared with

  • YAML Linter vs JSON Validatoryou are checking a YAML file, a CI pipeline, a Kubernetes manifest, a Docker Compose file : compared with json-validator