rspec/rules/S1854/plsql/rule.adoc
2023-10-13 12:26:37 +02:00

61 lines
1.1 KiB
Plaintext

include::../why.adoc[]
=== Exceptions
This rule ignores initializations to `-1`, `0`, `1`, `NULL`, `TRUE`, `FALSE` and `""`.
include::../howtofixit.adoc[]
=== Code examples
==== Noncompliant code example
[source,sql,diff-id=1,diff-type=noncompliant]
----
declare
my_user VARCHAR2(30);
my_date VARCHAR2(30);
begin
my_user := user();
my_date := sysdate(); -- Noncompliant, the value of my_date is never read
dbms_output.put_line('User:' || my_user || ', date: ' || my_user);
end;
----
==== Compliant solution
[source,sql,diff-id=1,diff-type=compliant]
----
declare
my_user VARCHAR2(30);
my_date VARCHAR2(30);
begin
my_user := user();
my_date := sysdate();
dbms_output.put_line('User:' || my_user || ', date: ' || my_date);
end;
----
include::../see.adoc[]
=== Related rules
* S1763 - All code should be reachable
* S3626 - Jump statements should not be redundant
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[]