Skip to content

statement-blank-lines

all languagesstyleno fixdefault: offcmake/cmake-lint

Reports more than max blank lines (default 1) right before a top-level statement (a direct child of the file that starts its line). The first statement of a file may have one more. Block arms and closers of the language (else, endif) are not checked. A line with only white space counts as blank. The finding is on the first token of the statement.

A run of blank lines is a visual gap that separates parts of a file. One blank line separates statements well, and more leave holes that make the file look as if something is missing.

To fix, delete the extra blank lines.

Reported
...
set(b 2)
set(c 3)
if(x)
...
lint:
rules:
statement-blank-lines:
level: warn # off (default), warn, error
options:
max: 1
Option Type Default Description
max int 1 The longest run of blank lines allowed before a statement.

Enabled by the presets: cmake/cmake-lint.

Suppress one line with sudsy-disable-next-line statement-blank-lines in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
cmake-lint C0305 full