Skip to content

empty-conditional-block

Detect empty statement blocks that need removal or explanation.

Updated View as Markdown

Default severity: error

Catch empty if and else branches that are usually unfinished code or accidental no-ops.

Behavior

Empty functions, methods, closures, and loop bodies are accepted because they are commonly intentional stubs, marker methods, callbacks, or drain loops and have different semantics from an empty conditional branch.

Bad

if err != nil {
}

Good

if err != nil {
	return err
}
Navigation

Type to search…

↑↓ navigate↵ selectEsc close