Skip to main content
Disallows trailing whitespace at the end of lines.

Description

Trailing whitespace (spaces and tabs at the end of lines) is invisible noise that clutters diffs in version control. This rule detects and can automatically remove trailing whitespace from all lines in a Dockerfile.

Companion editor configuration

Use EditorConfig integration to configure IDEs and editors to trim trailing whitespace before tally reports it.

Examples

Bad

(where · = space, = tab)

Good

Configuration

Default (no config needed):
Skip blank lines that consist entirely of whitespace:
Ignore comment lines:
Both options:

Options

Auto-fix

This rule provides a safe auto-fix that removes trailing whitespace from offending lines:
Each trailing whitespace occurrence is removed independently, so the fix count equals the number of affected lines.