rspec/rules/S1608/rpg/rule.adoc

51 lines
896 B
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
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
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,rpg]
2021-04-28 16:49:39 +02:00
----
C MOVE ' ' FLD1
----
2022-02-04 17:28:24 +01:00
[source,rpg]
2021-04-28 16:49:39 +02:00
----
/free
fld1 = ' ';
/end-free
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,rpg]
2021-04-28 16:49:39 +02:00
----
C MOVE *BLANK FLD1
----
2022-02-04 17:28:24 +01:00
[source,rpg]
2021-04-28 16:49:39 +02:00
----
/free
fld1 = *BLANK;
/end-free
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]