Skip to content

trailing-spaces

What this rule does

Reports whitespace at the end of any line.

Why this matters

  • Invisible drift. Trailing whitespace is invisible in most editors but shows up as a change in every diff, polluting code review.
  • Editor normalisation. Many editors strip trailing whitespace on save; without this rule, contributors with different editor settings produce conflicting commits.

Configuration

[rules.trailing-spaces]
level = "error"

This rule has no options beyond level.

Examples

✅ Allowed

---
key: value

(No spaces between value and the newline.)

❌ Reported

---
key: value···

(Where ··· represents trailing whitespace characters.)

Automatic fixing

This rule does not auto-fix in ryl. Most editors and pre-commit hooks strip trailing whitespace; rely on those when available.

  • new-line-at-end-of-file — controls the trailing newline character.
  • empty-lines — controls fully blank lines (a separate concern from trailing whitespace on content lines).