Skip to content

tally/no-multi-spaces

Disallows multiple consecutive spaces within Dockerfile instructions.

Property Value
Severity Style
Category Style
Default Enabled
Auto-fix Yes (safe)

Description

Multiple consecutive spaces within Dockerfile instructions are usually accidental and make the code harder to read. This rule flags any run of 2 or more consecutive space characters within instruction lines.

The following are excluded:

  • Leading indentation: whitespace before the instruction keyword
  • Heredoc body lines: content between heredoc markers (semantically significant)
  • Comment lines: lines starting with #

Examples

Bad

FROM  alpine:3.20
RUN  apk add  --no-cache  curl
COPY  . /app

Good

FROM alpine:3.20
RUN apk add --no-cache curl
COPY . /app

Auto-fix

This rule provides a safe auto-fix that replaces each run of multiple spaces with a single space:

tally lint --fix Dockerfile

Each contiguous run of extra spaces is replaced independently, so a line with multiple occurrences receives one edit per run.

Configuration

No custom configuration options. The rule is enabled by default with severity "style".

# Disable the rule
[rules.tally.no-multi-spaces]
severity = "off"