Skip to content

Duplicated conditions in If...Then...ElseIf... statements (IfElseDuplicatedCondition)

Type Scope Severity Activated
by default
Minutes
to fix
Tags
Code smell BSL
OS
Major Yes 10 suspicious

Description

If...Then...ElseIf... statement should not have duplicated conditions.

Examples

If p = 0 Then
    t = 0;
ElseIf p = 1 Then
    t = 1;
ElseIf p = 1 Then
    t = 2;
Else
    t = -1;
EndIf;

Snippets

Diagnostic ignorance in code

// BSLLS:IfElseDuplicatedCondition-off
// BSLLS:IfElseDuplicatedCondition-on

Parameter for config

"IfElseDuplicatedCondition": false