rspec/rules/S1629/rpg/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

67 lines
1.2 KiB
Plaintext

== Why is this an issue?
While ``++END++`` will adequately close a statement, it is less clear than the use of the relevant, statement-specific ``++ENDxx++``. Thus, the statement-specific version is preferred to facilitate code maintenance and enhance clarity.
This rule is applied to the following operations: ``++CASxx++``, ``++DO++``, ``++DOU++``, ``++DOUxx++``, ``++DOW++``, ``++DOWxx++``, ``++FOR++``, ``++IF++``, ``++IFxx++`` and ``++SELECT++`` groups.
=== Noncompliant code example
[source,rpg]
----
C W0PKEX DOUEQ W0ON
...
C END
C W0PKEX IFEQ W0ON
...
C END
----
[source,rpg]
----
/free
if x = 1;
...
end;
/end-free
----
=== Compliant solution
[source,rpg]
----
C W0PKEX DOUEQ W0ON
...
C ENDDO
C W0PKEX IFEQ W0ON
...
C ENDIF
----
[source,rpg]
----
/free
if x = 1;
...
endif;
/end-free
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Use the "[ENDxx]" statement to close this [xxx] clause.
endif::env-github,rspecator-view[]