
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
74 lines
1.2 KiB
Plaintext
74 lines
1.2 KiB
Plaintext
== Why is this an issue?
|
|
|
|
This rule checks that all string literals use the same kind of quotes.
|
|
|
|
|
|
=== Noncompliant code example
|
|
|
|
Using the parameter default (forcing single quotes):
|
|
|
|
[source,javascript]
|
|
----
|
|
var firstParameter = "something"; // Noncompliant
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,javascript]
|
|
----
|
|
var firstParameter = 'something';
|
|
----
|
|
|
|
|
|
=== Exceptions
|
|
|
|
Strings that contain quotes are ignored.
|
|
|
|
[source,javascript]
|
|
----
|
|
let heSaid = "Then he said 'What?'." // ignored
|
|
let sheSaid = '"Whatever!" she replied.' // ignored
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Use string literals quotes consistently
|
|
|
|
|
|
=== Parameters
|
|
|
|
.singleQuotes
|
|
****
|
|
|
|
----
|
|
true
|
|
----
|
|
|
|
Set to true to require single quotes, false for double quotes.
|
|
****
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 1 Nov 2016, 17:04:09 Elena Vilchik wrote:
|
|
\[~ann.campbell.2] Could you please add exceptions to this rule (they are both implemented already)?
|
|
|
|
* if string literal contains ``++'++`` (SONARJS-796)
|
|
* if string literal is part of JSX (SONARJS-681)
|
|
Thanks!
|
|
|
|
=== on 1 Nov 2016, 18:21:18 Ann Campbell wrote:
|
|
Done [~elena.vilchik]
|
|
|
|
endif::env-github,rspecator-view[]
|