rspec/rules/S3923/cobol/rule.adoc

39 lines
948 B
Plaintext
Raw Normal View History

2021-01-27 13:42:22 +01:00
Having all branches in an ``++EVALUATE++`` or ``++IF++`` chain with the same implementation is an error. Either a copy-paste error was made and something different should be executed, or there shouldn't be an ``++EVALUATE++``/``++IF++`` chain at all.
2020-06-30 12:48:39 +02:00
== Noncompliant Code Example
----
EVALUATE X *> Noncompliant
WHEN 1
PERFORM SECTION1
WHEN OTHER
PERFORM SECTION1
END-EVALUATE.
IF X = 1 THEN *> Noncompliant
PERFORM SECTION1
ELSE
PERFORM SECTION1
END-IF.
----
== Exceptions
2021-01-27 13:42:22 +01:00
Note that this rule does not apply to ``++IF++`` chains without ``++ELSE++``-s, or to ``++EVALUATE++``-s without ``++WHEN OTHER++`` clauses.
2020-06-30 12:48:39 +02:00
2021-02-02 15:02:10 +01:00
2020-06-30 12:48:39 +02:00
----
IF X = 1 THEN *> //no issue, this could have been done on purpose to make the code more readable
PERFORM SECTION1
ELSE-IF X = 2 THEN
PERFORM SECTION1
END-IF.
----
ifdef::rspecator-view[]
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::rspecator-view[]