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:
Marco Borgeaud 2023-08-15 13:34:10 +02:00 committed by GitHub
parent dde2f675f7
commit ffde1ebd9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -4,7 +4,7 @@
==== Noncompliant code example
[source,kotlin,diff-id=1,diff-type=noncompliant]
[source,kotlin,diff-id=11,diff-type=noncompliant]
----
import okhttp3.ConnectionSpec;
import okhttp3.TlsVersion;
@ -18,7 +18,7 @@ fun main(args: Array<String>) {
==== Compliant solution
[source,kotlin,diff-id=1,diff-type=compliant]
[source,kotlin,diff-id=11,diff-type=compliant]
----
import okhttp3.ConnectionSpec;
import okhttp3.TlsVersion;

View File

@ -54,7 +54,7 @@ fun dispatchFunction(instance: Any) {
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 {
// ...
@ -70,7 +70,7 @@ fun compare(a: Int, b: Int): Int {
==== 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 {
// ...