Commented out code (CommentedCode)¶
Type | Scope | Severity | Activated by default |
Minutes to fix |
Tags |
---|---|---|---|---|---|
Code smell |
BSL OS |
Minor |
Yes |
1 |
standard badpractice |
Parameters¶
Name | Type | Description | Default value |
---|---|---|---|
threshold |
Float |
Threshold |
0.9 |
exclusionPrefixes |
String |
Exclusion prefixes |
`` |
Description¶
Software modules should not have commented out code fragments, as well as fragments, which are in any way connected with the development process (debugging code, service marks, i.e. !!! _, MRG, etc.) and with specific developers of this code.
For example, it is unacceptable to leave such fragments in the code after debugging or refactoring is completed:
Procedure BeforeDelete(Failure)
//If True Then
// Message("For debugging");
//EndIf;
EndProcedure
Procedure BeforeDelete(Failure)
If True Then
// Ivanov: need fix
EndIf;
EndProcedure
Correct: after debugging or refactoring is completed, remove the handler BeforeDelete from the code.
ATTENTION:
A code block is considered commented, if at least one line inside the block is defined as code.
Sources¶
Snippets¶
Diagnostic ignorance in code¶
// BSLLS:CommentedCode-off
// BSLLS:CommentedCode-on
Parameter for config¶
"CommentedCode": {
"threshold": 0.9,
"exclusionPrefixes": ""
}