Skip to content

max-body-length

Makefilecleanupno fixdefault: offmakefile/checkmake

Reports a rule whose recipe has more lines than the max option. Every physical line counts, a continued command and a tab-indented comment included.

A long recipe is a script that lives in a Makefile, where it is run by make through the shell line by line, cannot be tested by itself and is hard to read. A limit moves it to a script file.

To fix, move the commands to a script and call it.

Reported
build:
echo 1
echo 2
echo 3
...
echo 1
blank-before:
echo 1
echo 2
echo 3
...
makefile:
lint:
rules:
max-body-length:
level: warn # off (default), warn, error
options:
max: 5
Option Type Default Description
max int 5 The most lines a recipe may have.

Enabled by the presets: makefile/checkmake.

Suppress one line with sudsy-disable-next-line max-body-length in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
checkmake maxbodylength partial checkmake ends a recipe at a blank line, a comment line without a tab or a conditional; Sudsy follows make, where they belong to the recipe.