rspec/rules/S4883/cobol/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

58 lines
1.1 KiB
Plaintext

== Why is this an issue?
This rule is a more precise version of S1308 preventing the use of ``++GO TO++``. The flow of a program is already complicated to understand with simple ``++GO TO++``s. It's even worse when a ``++GO TO++`` is executed conditionally like this is the case with ``++GO TO DEPENDING ON++``.
=== Noncompliant code example
[source,cobol]
----
PROCEDURE DIVISION.
...
GO TO PARAGRAPH-10
PARAGRAPH-20
PARAGRAPH-30
DEPENDING ON WS-PARA-NUMBER *> Noncompliant
...
----
=== Compliant solution
[source,cobol]
----
PROCEDURE DIVISION.
...
EVALUATE WS-PARA-NUMBER
WHEN 1
PERFORM PARAGRAPH-10
WHEN 2
PERFORM PARAGRAPH-20
WHEN 3
PERFORM PARAGRAPH-30
WHEN OTHER
PERFORM PARAGRAPH-99
END-EVALUATE
...
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Refactor this code to remove the GO TO DEPENDING ON statement.
'''
== Comments And Links
(visible only on this page)
=== relates to: S1308
endif::env-github,rspecator-view[]