
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.
65 lines
1.2 KiB
Plaintext
65 lines
1.2 KiB
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
With the default threshold of 3:
|
|
|
|
[source,php]
|
|
----
|
|
function run() {
|
|
prepare('this is a duplicate'); // Noncompliant - 'this is a duplicate' is duplicated 3 times
|
|
execute('this is a duplicate');
|
|
release('this is a duplicate');
|
|
}
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,php]
|
|
----
|
|
MESSAGE = 'this is a duplicate';
|
|
|
|
function run() {
|
|
prepare(MESSAGE);
|
|
execute(MESSAGE);
|
|
release(MESSAGE);
|
|
}
|
|
----
|
|
|
|
=== Exceptions
|
|
|
|
No issue will be raised on:
|
|
|
|
* strings with less than 5 characters
|
|
* strings with only letters, numbers, underscores, hyphens and periods
|
|
|
|
[source,php]
|
|
----
|
|
$severity = $request->getParam('severity-score');
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::../message.adoc[]
|
|
|
|
include::../parameters.adoc[]
|
|
|
|
include::../highlighting.adoc[]
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 30 Jun 2020, 16:03:21 Ann Campbell wrote:
|
|
\[~nils.werner] "strings must start with a letter" doesn't make sense to me as an exception.
|
|
|
|
include::../comments-and-links.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|