rspec/rules/S134/rpg/rule.adoc

55 lines
967 B
Plaintext

== Why is this an issue?
Nested ``++CASxx++``, ``++DO++``, ``++DOU++``, ``++DOW++``, ``++DOUxx++``, ``++DOWxx++``, ``++FOR++``, ``++IF++``, ``++IFxx++``, ``++MONITOR++`` and ``++SELECT++`` statements is a key ingredient for making what's known as "Spaghetti code".
Such code is hard to read, refactor and therefore maintain.
=== Noncompliant code example
With the default threshold of 3:
[source,rpg]
----
IF A <> B
IF B <> C
DOW B <> A
IF A <> D
...
ENDIF
ENDDO
ENDIF
ENDIF
----
[source,rpg]
----
if a <> b;
if b <> c;
dow b <> a;
if a <> d;
...
endif;
enddo;
endif;
endif;
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
include::../parameters.adoc[]
include::../highlighting.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]