rspec/rules/S1608/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

59 lines
1.1 KiB
Plaintext

== Why is this an issue?
Initializing an alphanumeric field with the literal character ``++' '++``, ``++'1'++``, or ``++'0'++`` has the same effect as using the equivalent figurative constant ``++*BLANK++``, ``++*ON++``, or ``++*OFF++``, but the constant version removes ambiguity and makes the code more readable.
=== Noncompliant code example
[source,rpg]
----
C MOVE ' ' FLD1
----
[source,rpg]
----
/free
fld1 = ' ';
/end-free
----
=== Compliant solution
[source,rpg]
----
C MOVE *BLANK FLD1
----
[source,rpg]
----
/free
fld1 = *BLANK;
/end-free
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Replace this string literal 'x' literal with YYY
'''
== Comments And Links
(visible only on this page)
=== on 4 Mar 2014, 16:36:23 Ann Campbell wrote:
updated spec per email from customer, which does not use empty string:
the ' ' literal is not to be used to represent *BLANK
endif::env-github,rspecator-view[]