rspec/rules/S1192/rpg/rule.adoc
Fred Tingaud 51369b610e
Make sure that includes are always surrounded by empty lines (#2270)
When an include is not surrounded by empty lines, its content is inlined
on the same line as the adjacent content. That can lead to broken tags
and other display issues.
This PR fixes all such includes and introduces a validation step that
forbids introducing the same problem again.
2023-06-22 10:38:01 +02:00

72 lines
1.5 KiB
Plaintext

== Why is this an issue?
include::../description.adoc[]
=== Noncompliant code example
With the default threshold of 3:
[source,rpg]
----
C MOVEL 'CLEAR' W1CLR Noncompliant
C MOVEL '*DECOD' W1DCDE
C MOVEL '*ERROR' W1ERR
C MOVEL '*EXIT ' W1EXIT
C MOVEL 'CLEAR' W1FIRT
C MOVEL 'CLEAR' W1HELP
----
[source,rpg]
----
/free
W1CLR = 'CLEAR'; // Noncompliant
W1FIRT = 'CLEAR';
W1HELP = 'CLEAR';
/end-free
----
=== Compliant solution
[source,rpg]
----
D W0Clr C CONST('CLEAR')
C MOVEL W0Clr W1CLR
C MOVEL '*DECOD' W1DCDE
C MOVEL '*ERROR' W1ERR
C MOVEL '*EXIT ' W1EXIT
C MOVEL W0Clr W1FIRT
C MOVEL W0Clr W1HELP
----
[source,rpg]
----
D W0Clr C CONST('CLEAR')
/free
W1CLR = W0Clr;
W1FIRT = W0Clr;
W1HELP = W0Clr;
/end-free
----
include::../exceptions.adoc[]
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[]