Diff blocks: fix some incorrect use for kotlin (#2803)
Improvement identified in #2790. Add a prefix to the diff-id when it is used multiple times in different "how to fix it in XYZ" sections to avoid ambiguity and pedantically follow the spec: > A single and unique diff-id should be used only once for each type of code example as shown in the description of a rule. Obvious typos around `diff-id` were fixed.
This commit is contained in:
parent
dde2f675f7
commit
ffde1ebd9a
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
==== Noncompliant code example
|
==== Noncompliant code example
|
||||||
|
|
||||||
[source,kotlin,diff-id=1,diff-type=noncompliant]
|
[source,kotlin,diff-id=11,diff-type=noncompliant]
|
||||||
----
|
----
|
||||||
import okhttp3.ConnectionSpec;
|
import okhttp3.ConnectionSpec;
|
||||||
import okhttp3.TlsVersion;
|
import okhttp3.TlsVersion;
|
||||||
@ -18,7 +18,7 @@ fun main(args: Array<String>) {
|
|||||||
|
|
||||||
==== Compliant solution
|
==== Compliant solution
|
||||||
|
|
||||||
[source,kotlin,diff-id=1,diff-type=compliant]
|
[source,kotlin,diff-id=11,diff-type=compliant]
|
||||||
----
|
----
|
||||||
import okhttp3.ConnectionSpec;
|
import okhttp3.ConnectionSpec;
|
||||||
import okhttp3.TlsVersion;
|
import okhttp3.TlsVersion;
|
||||||
|
@ -54,7 +54,7 @@ fun dispatchFunction(instance: Any) {
|
|||||||
|
|
||||||
When `threshold = 2`
|
When `threshold = 2`
|
||||||
|
|
||||||
[source,kotlin,diff-id=1,diff-type=noncompliant]
|
[source,kotlin,diff-id=2,diff-type=noncompliant]
|
||||||
----
|
----
|
||||||
fun compare(a: Int, b: Int): Int {
|
fun compare(a: Int, b: Int): Int {
|
||||||
// ...
|
// ...
|
||||||
@ -70,7 +70,7 @@ fun compare(a: Int, b: Int): Int {
|
|||||||
|
|
||||||
==== Compliant solution
|
==== Compliant solution
|
||||||
|
|
||||||
[source,kotlin,diff-id=1,diff-type=compliant]
|
[source,kotlin,diff-id=2,diff-type=compliant]
|
||||||
----
|
----
|
||||||
fun compare(a: Int, b: Int): Int {
|
fun compare(a: Int, b: Int): Int {
|
||||||
// ...
|
// ...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user