
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.
62 lines
1.1 KiB
Plaintext
62 lines
1.1 KiB
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,javascript]
|
|
----
|
|
for (var i = 1; i != 10; i += 2) // Noncompliant. Infinite; i goes from 9 straight to 11.
|
|
{
|
|
//...
|
|
}
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
for (var i = 1; i <= 10; i += 2) // Compliant
|
|
{
|
|
//...
|
|
}
|
|
----
|
|
|
|
=== Exceptions
|
|
|
|
Equality operators are ignored if the loop counter is not modified within the body of the loop and either:
|
|
|
|
* starts below the ending value and is incremented by 1 on each iteration.
|
|
* starts above the ending value and is decremented by 1 on each iteration.
|
|
|
|
Equality operators are also ignored when the test is against ``++null++``.
|
|
|
|
[source,javascript]
|
|
----
|
|
for (var i = 0; arr[i] != null; i++) {
|
|
// ...
|
|
}
|
|
|
|
for (var i = 0; (item = arr[i]) != null; i++) {
|
|
// ...
|
|
}
|
|
----
|
|
|
|
include::../see.adoc[]
|
|
|
|
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[]
|