rspec/rules/S2537/plsql/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

58 lines
1.2 KiB
Plaintext

== Why is this an issue?
Quoted identifiers are confusing to many programmers, as they look similar to string literals. Moreover, for maximum portability, identifiers should be self-descriptive and should not contain accents. Quoted identifiers can contain any character, which can be confusing.
=== Noncompliant code example
[source,sql]
----
SET SERVEROUTPUT ON
DECLARE
"x + y" PLS_INTEGER := 0; -- Noncompliant, quoted identifiers are confusing
x PLS_INTEGER := 40;
y PLS_INTEGER := 2;
"hello" VARCHAR2(42) := 'world'; -- Noncompliant
BEGIN
DBMS_OUTPUT.PUT_LINE("x + y"); -- Noncompliant, displays 0
DBMS_OUTPUT.PUT_LINE("hello"); -- Noncompliant, confusing, displays "world" and not "hello"
END;
/
----
=== Compliant solution
[source,sql]
----
SET SERVEROUTPUT ON
DECLARE
my_int PLS_INTEGER := 0;
x PLS_INTEGER := 40;
y PLS_INTEGER := 2;
greeting VARCHAR2(42) := 'hello';
BEGIN
DBMS_OUTPUT.PUT_LINE(my_int);
DBMS_OUTPUT.PUT_LINE(x + y); -- Compliant, displays 42
DBMS_OUTPUT.PUT_LINE(greeting);
END;
/
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Rename this identifier to remove the quotes.
endif::env-github,rspecator-view[]