
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.
60 lines
1.0 KiB
Plaintext
60 lines
1.0 KiB
Plaintext
== Why is this an issue?
|
|
|
|
When a single primitive is tested against three or more values in an ``++IF++``, ``++ELSIF++`` chain, it should be converted to a ``++CASE++`` instead for greater readability.
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,sql]
|
|
----
|
|
DECLARE
|
|
x PLS_INTEGER := 0;
|
|
BEGIN
|
|
IF x = 0 THEN -- Noncompliant
|
|
DBMS_OUTPUT.PUT_LINE('x = 0');
|
|
ELSIF x = 1 THEN
|
|
DBMS_OUTPUT.PUT_LINE('x = 1');
|
|
ELSE
|
|
DBMS_OUTPUT.PUT_LINE('x > 1');
|
|
END IF;
|
|
END;
|
|
/
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,sql]
|
|
----
|
|
DECLARE
|
|
x PLS_INTEGER := 0;
|
|
BEGIN
|
|
CASE x
|
|
WHEN 0 THEN
|
|
DBMS_OUTPUT.PUT_LINE('x = 0');
|
|
WHEN 1 THEN
|
|
DBMS_OUTPUT.PUT_LINE('x = 1');
|
|
ELSE
|
|
DBMS_OUTPUT.PUT_LINE('x > 1');
|
|
END CASE;
|
|
END;
|
|
/
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Convert this "IF/ELSIF" structure into a "CASE".
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|