documented-command
What it does
Section titled “What it does”Reports a command listed in the option commands (for example function and macro in CMake, compared ignoring case) that has no comment on the line right before it, or whose comment has no text (# alone). A comment further up with a blank line between, or code in between, does not count. The option doc_kinds limits which comment kinds document (all by default); a comment of another kind counts as an empty one.
Why it matters
Section titled “Why it matters”A function or macro is called from other files, so a reader meets the name far from its definition. A comment right above it is the place where tools and readers look for what it takes and does.
To fix, write the comment on the line before the definition.
Example
Section titled “Example”...
# Detached.
function(b)endfunction()#macro(c)endmacro()set(d 1)#[[ block ]]function(e)endfunction()# Text.#...Configuration
Section titled “Configuration”lint: rules: documented-command: level: warn # off (default), warn, error options: commands: [] doc_kinds: []| Option | Type | Default | Description |
|---|---|---|---|
commands |
list | [] |
The commands that need a comment (case ignored). |
doc_kinds |
list | [] |
The kinds of comment token that document (none listed: every comment does); a comment of another kind counts as one with no text. |
Enabled by the presets: cmake/cmake-lint.
Suppress one line with sudsy-disable-next-line documented-command 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 | C0111 |
full |
| cmake-lint | C0112 |
full |