...
The presence of code that has no effect can indicate logic errors that may result in unexpected behavior and vulnerabilities. Unused values in code may indicate significant logic errors.
Unused classes, methods, and variables that are part of an exported library do not violate this guideline.
Code and values that have no effect can be detected by suitable static analysis.
Automated Detection
Tool | Version | Checker | Description |
---|---|---|---|
SonarQube |
|
|
| S1854 |
...
Bibliography
[Coverity 2007] | Coverity Prevent User's Manual (3.3.0) |
[Fortify 2013] | Code Quality, "Dead Code" |
...
...