Skip to main content
Disallows trailing whitespace at the end of lines.
PropertyValue
SeverityStyle
CategoryStyle
DefaultEnabled
Auto-fixYes (safe)

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.

Examples

Bad

FROM alpine:3.20···
RUN echo hello··
COPY . /app→
(where · = space, = tab)

Good

FROM alpine:3.20
RUN echo hello
COPY . /app

Configuration

Default (no config needed):
# Enabled by default with no special options
Skip blank lines that consist entirely of whitespace:
[rules.tally.no-trailing-spaces]
skip-blank-lines = true
Ignore comment lines:
[rules.tally.no-trailing-spaces]
ignore-comments = true
Both options:
[rules.tally.no-trailing-spaces]
skip-blank-lines = true
ignore-comments = true

Options

OptionTypeDefaultDescription
skip-blank-linesbooleanfalseSkip lines that are entirely whitespace
ignore-commentsbooleanfalseSkip any line starting with # (Dockerfile comments and # lines inside heredoc bodies)

Auto-fix

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