
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.
43 lines
971 B
Plaintext
43 lines
971 B
Plaintext
== Why is this an issue?
|
|
|
|
Instead of creating an array and then setting its items one by one, creation an initialization can - and should - happen all in one step. Doing so results in clearer code and eliminates the possibility that an item might be accidentally overwritten or left uninitialized.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,javascript]
|
|
----
|
|
var colors = []; // Noncompliant
|
|
colors[1] = "red"; // Oops! Explicit initialization means that the 0th element is left empty
|
|
colors[2] = "green";
|
|
colors[2] = "blue"; // Oops again! "green" overwritten
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
var colors = ["red","green","blue"];
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Create and initialize the "xxx" array using array literal syntax.
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|