Query module EmptyBlock

name
Empty branch of conditional
description
An empty block after a conditional can be a sign of an omission and can decrease maintainability of the code. Such blocks should contain an explanatory comment to aid future maintainers.
kind
problem
problem.severity
recommendation
precision
very-high
id
cpp/empty-block
tags
reliability readability

Imports

cpp

Provides classes and predicates for working with C/C++/ObjC/ObjC++ code.

Predicates

emptyBlock
emptyBlockContainsNonchild

A block that contains a non-child element.

lineComment

A block that is entirely on one line, which also contains a comment. Chances are the comment is intended to refer to the block.

Classes

AffectedFile
BlockOrNonChild

A block, or an element we might find textually within a block that is not a child of it in the AST.