Fred Tingaud 51369b610e
Make sure that includes are always surrounded by empty lines (#2270)
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.
2023-06-22 10:38:01 +02:00

83 lines
1.7 KiB
Plaintext

== Why is this an issue?
Shared naming conventions allow teams to collaborate effectively. This rule raises an issue when the brace-style is not respecting the convention setup in parameter:
* https://en.wikipedia.org/wiki/Indentation_style#K&R_style[1tbs] (default)
* https://en.wikipedia.org/wiki/Indentation_style#Allman_style[allman]
* https://en.wikipedia.org/wiki/Indentation_style#Variant:_Stroustrup[stroustrup]
=== Noncompliant code example
Using the parameter default (1tbs):
[source,javascript]
----
if (condition)
{ //Noncompliant
doSomething();
} //Noncompliant
else {
doSomethingElse();
}
----
=== Compliant solution
[source,javascript]
----
if (condition) { //Compliant
doSomething();
} else { //Compliant
doSomethingElse();
}
----
=== Exceptions
* Object literals appearing as arguments can start on their own line.
[source,javascript]
----
functionWithObject(
{ //Compliant
g: "someValue"
}
);
----
* When blocks are inlined (left and right curly braces on the same line), no issue is triggered.
[source,javascript]
----
if(condition) {doSomething();} //Compliant
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
=== Parameters
.braceStyle
****
----
1tbs
----
enforced brace-style: 1tbs, stroustrup or allman.
****
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]