rspec/rules/S1475/cobol/rule.adoc

70 lines
922 B
Plaintext
Raw Permalink Normal View History

== Why is this an issue?
Any statement after a ``++STOP RUN++`` or ``++GOBACK++`` is unreachable and therefore dead code which should be removed.
=== Noncompliant code example
2022-02-04 17:28:24 +01:00
[source,cobol]
----
PARAGRAPH1.
MOVE A TO B.
STOP RUN.
MOVE B TO C.
----
or
2022-02-04 17:28:24 +01:00
[source,cobol]
----
PARAGRAPH1.
MOVE A TO B.
GOBACK.
MOVE B TO C.
----
=== Compliant solution
2022-02-04 17:28:24 +01:00
[source,cobol]
----
PARAGRAPH1.
MOVE A TO B.
MOVE B TO C.
STOP RUN.
----
or
2022-02-04 17:28:24 +01:00
[source,cobol]
----
PARAGRAPH1.
MOVE A TO B.
MOVE B TO C.
GOBACK.
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
This [STOP RUN|GOBACK] statement should be moved to the end of the statement sequence.
'''
== Comments And Links
(visible only on this page)
=== relates to: S1577
=== is related to: S1763
endif::env-github,rspecator-view[]