25 lines
797 B
Plaintext
25 lines
797 B
Plaintext
=== Exceptions
|
|
|
|
Blocks in an `IF` chain or in `CASE` statement that contain a single line of code are ignored.
|
|
|
|
[source,abap]
|
|
----
|
|
IF a >= 0 AND a < 10.
|
|
doTheThing.
|
|
ELSEIF a >= 10 AND a < 20.
|
|
doTheOtherThing.
|
|
ELSEIF a >= 20 AND a < 50.
|
|
doTheThing. // no issue, usually this is done on purpose to increase the readability
|
|
ENDIF.
|
|
----
|
|
|
|
But this exception does not apply to `IF` chains without final `ELSE`-s, or to `CASE`-s without `WHEN OTHERS` clauses when all branches have the same single line of code. In case of `IF` chains with `ELSE`-s, or of `CASE`-s with `WHEN OTHERS` clauses, rule S3923 raises a bug.
|
|
|
|
[source,abap]
|
|
----
|
|
IF a >= 0 AND a < 10. //Noncompliant, this might have been done on purpose but probably not
|
|
doTheThing.
|
|
ELSEIF a >= 10 AND a < 20.
|
|
doTheThing.
|
|
ENDIF.
|
|
---- |