Skip to content

Files

Latest commit

 

History

History
42 lines (27 loc) · 689 Bytes

EmptyStatement.md

File metadata and controls

42 lines (27 loc) · 689 Bytes

Pattern: Use of empty statement

Issue: -

Description

Typing mistakes and misunderstandings about where semicolons are required can lead to semicolons that are unnecessary. While not technically an error, extra semicolons can cause confusion when reading code.

Default configuration

<module name="EmptyStatement"/>

Examples

Example of incorrect code:

doSomething();;

while (condition)
{
    ;
}

Example of correct code:

doSomething();

while (condition)
{
    /** intentionally empty */
}

Further Reading