2020-06-30 12:47:33 +02:00
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:
2020-06-30 14:49:38 +02:00
* 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]
2020-06-30 12:47:33 +02:00
== Noncompliant Code Example
Using the parameter default (1tbs):
2020-06-30 14:49:38 +02:00
2020-06-30 12:47:33 +02:00
----
if (condition)
{ //Noncompliant
doSomething();
} //Noncompliant
else {
doSomethingElse();
}
----
== Compliant Solution
----
if (condition) { //Compliant
doSomething();
} else { //Compliant
doSomethingElse();
}
----
== Exceptions
2020-06-30 14:49:38 +02:00
* Object literals appearing as arguments can start on their own line.
2020-06-30 12:47:33 +02:00
----
functionWithObject(
{ //Compliant
g: "someValue"
}
);
----
2020-06-30 14:49:38 +02:00
* When blocks are inlined (left and right curly braces on the same line), no issue is triggered.
2020-06-30 12:47:33 +02:00
----
if(condition) {doSomething();} //Compliant
----
2021-06-02 20:44:38 +02:00
2021-06-03 09:05:38 +02:00
ifdef::env-github,rspecator-view[]
2021-06-08 15:52:13 +02:00
'''
2021-06-02 20:44:38 +02:00
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
2021-06-03 09:05:38 +02:00
endif::env-github,rspecator-view[]