-
Type:
Code Smell Detection
-
Status: Active
-
Resolution: Unresolved
-
Message:Remove this empty statement.
-
Default Severity:Minor
-
Impact:Low
-
Likelihood:Low
-
Default Quality Profiles:Sonar way
-
Legacy Key:EmptyStatementUsageCheck
-
Covered Languages:C#, C, C++, CSS, Flex, Go, Java, JavaScript, Objective-C, PHP, T-SQL, TypeScript, VB6
-
Irrelevant for Languages:ABAP, Cobol, HTML, PL/I, PL/SQL, Python, RPG, Swift, VB.Net, XML
-
Remediation Function:Constant/Issue
-
Constant Cost:2min
-
Analysis Level:Syntactic Analysis
-
Analysis Scope:Main Sources, Test Sources
-
Common Rule:Yes
-
CERT:MSC12-C., MSC51-J., EXP15-C.
-
Checkstyle:EmptyStatement
-
CPPCheck:suspiciousSemicolon
-
ESLint:no-extra-semi
-
FindBugs:UCF_USELESS_CONTROL_FLOW_NEXT_LINE
-
PC-Lint:9138
-
PMD:EmptyStatementNotInLoop
-
ReSharper:EmptyEmbeddedStatement, EmptyStatement
-
Stylelint:no-extra-semicolons
-
TSLint-SonarTS:no-extra-semicolon
-
VisualStudio:CS0642
-
Quick-fixes:
Empty statements, i.e. ;, are usually introduced by mistake, for example because:
- It was meant to be replaced by an actual statement, but this was forgotten.
- There was a typo which lead the semicolon to be doubled, i.e. ;;.
See
- CERT, MSC12-C. - Detect and remove code that has no effect or is never executed
- CERT, MSC51-J. - Do not place a semicolon immediately following an if, for, or while condition
- CERT, EXP15-C. - Do not place a semicolon on the same line as an if, for, or while statement
- contributes to
-
MMF-482 Bunch of valuable JS rules not relying on SE
-
- Closed
-
- is implemented by
-
SONARSLANG-39 Rule S1116: Empty statements should be removed
-
- Open
-
-
CPP-585 Rule: Empty statements should be removed
-
- Closed
-
-
SONARJS-807 Rule: Empty statements should be removed
-
- Closed
-
-
SONARTSQL-58 Rule: Empty statements should be removed
-
- Closed
-
-
SONARVB-276 Rule: Empty statements should be removed
-
- Closed
-
-
SONARVBSIX-155 Rule: Empty statements should be removed
-
- Closed
-
-
CPP-707 Create Objective-C rules repository containing targeted rules
-
- Closed
-
- is related to
-
CPP-1704 Update rule: add exception to EmptyStatementCheck (S1116)
-
- Closed
-
-
CPP-1835 S1116: Include empty statement ending a if statement
-
- Closed
-
-
RSPEC-3955 "if" and "while" statements should not lead to the execution of empty statements
- Closed
-
CPP-2737 S1116: Fix false-positives with " if constexpr" in template instantiation
-
- Closed
-
-
RSPEC-1763 All code should be reachable
- Active
-
RSPEC-901 Dead code should be removed
- Closed
- relates to
-
RSPEC-906 Before preprocessing, a null statement shall only occur on a line by itself; it may be followed by a comment provided that the first character following the null statement is a white-space character
- Closed
- links to
1.
|
C-Family | RSPEC-2892 |
|
Active | Unassigned | |
2.
|
VB6 | RSPEC-3202 |
|
Active | Unassigned | |
3.
|
Java | RSPEC-3203 |
|
Active | Unassigned | |
4.
|
Flex | RSPEC-3204 |
|
Active | Unassigned | |
5.
|
PHP | RSPEC-3205 |
|
Active | Unassigned | |
6.
|
C# | RSPEC-3206 |
|
Active | Unassigned | |
7.
|
Javascript: Extra semicolons should be removed | RSPEC-3762 |
|
Active | Unassigned | |
8.
|
Go | RSPEC-4591 |
|
Active | Unassigned | |
9.
|
CSS: Extra semicolons should be removed | RSPEC-4699 |
|
Active | Unassigned |