statement-blank-lines
What it does
Section titled “What it does”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.
Why it matters
Section titled “Why it matters”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.
Example
Section titled “Example”...set(b 2)
set(c 3)if(x)
...Configuration
Section titled “Configuration”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.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| cmake-lint | C0305 |
full |