diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1b031d3d..721cd27e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -15,6 +15,6 @@ binary-compatibility-validator = { id = "binary-compatibility-validator", versio dokka = { id = "org.jetbrains.dokka", version = "1.8.20" } kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" } kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } -kotlinter = { id = "org.jmailen.kotlinter", version = "3.15.0" } +kotlinter = { id = "org.jmailen.kotlinter", version = "3.16.0" } kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } maven-publish = { id = "com.vanniktech.maven.publish", version = "0.25.3" } diff --git a/koap/src/commonMain/kotlin/Decoder.kt b/koap/src/commonMain/kotlin/Decoder.kt index 280f5d0e..08051142 100644 --- a/koap/src/commonMain/kotlin/Decoder.kt +++ b/koap/src/commonMain/kotlin/Decoder.kt @@ -292,7 +292,7 @@ fun ByteArray.decodeTcpHeader(): Header.Tcp = withReader { // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ // | Extended Length (if any, as chosen by Len) ... // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - /* ktlint-disable no-multi-spaces */ + @Suppress("ktlint:standard:no-multi-spaces") val length = when (len) { in 0..12 -> len.toLong() // No Extended Length 13 -> (readUByte() + 13).toLong() // 8-bit unsigned integer @@ -300,7 +300,6 @@ fun ByteArray.decodeTcpHeader(): Header.Tcp = withReader { 15 -> readUInt() + 65805 // 32-bit unsigned integer else -> error("Invalid length $len") } - /* ktlint-enable no-multi-spaces */ // |7 6 5 4 3 2 1 0| // +-+-+-+-+-+-+-+-+ @@ -370,27 +369,25 @@ internal fun ByteArrayReader.readOption(preceding: Format?): Option? { // / Option Delta / 0-2 bytes // \ (extended) \ // +-------------------------------+ - /* ktlint-disable no-multi-spaces */ + @Suppress("ktlint:standard:no-multi-spaces") val delta = when (optionDelta) { in 0..12 -> optionDelta // No Extended Delta 13 -> readUByte() + 13 // 8-bit unsigned integer 14 -> readUShort() + 269 // 16-bit unsigned integer else -> error("Invalid option delta $optionDelta") } - /* ktlint-enable no-multi-spaces */ // +-------------------------------+ // / Option Length / 0-2 bytes // \ (extended) \ // +-------------------------------+ - /* ktlint-disable no-multi-spaces */ + @Suppress("ktlint:standard:no-multi-spaces") val length = when (optionLength) { in 0..12 -> optionLength // No Extended Length 13 -> readUByte() + 13 // 8-bit unsigned integer 14 -> readUShort() + 269 // 16-bit unsigned integer else -> error("Invalid option length $optionLength") } - /* ktlint-enable no-multi-spaces */ return when (val number = (preceding?.number ?: 0) + delta) { 1 -> IfMatch(readByteArray(length)) @@ -423,7 +420,7 @@ private fun Int.toType(): Message.Udp.Type = when (this) { else -> error("Unknown message type: $this") } -/* ktlint-disable no-multi-spaces */ +@Suppress("ktlint:standard:no-multi-spaces") private fun Int.toCode(): Message.Code = when (this) { 1 -> GET // 0.01 2 -> POST // 0.02 @@ -459,7 +456,6 @@ private fun Int.toCode(): Message.Code = when (this) { Message.Code.Raw(`class`, detail) } } -/* ktlint-enable no-multi-spaces */ /** * Reads specified number of [bytes] from [ByteArrayReader] receiver to acquire a number. diff --git a/koap/src/commonMain/kotlin/Encoder.kt b/koap/src/commonMain/kotlin/Encoder.kt index a1a0b3fc..a2244a18 100644 --- a/koap/src/commonMain/kotlin/Encoder.kt +++ b/koap/src/commonMain/kotlin/Encoder.kt @@ -171,14 +171,13 @@ internal fun BufferedSink.writeHeader( "Token length of $tokenLength is outside allowable range of $UINT4_RANGE" } - /* ktlint-disable no-multi-spaces */ + @Suppress("ktlint:standard:no-multi-spaces") val len = when { contentLength < 13 -> contentLength // No Extended Length contentLength < 269 -> 13 // Reserved, indicates 8-bit unsigned integer Extended Length contentLength < 65805 -> 14 // Reserved, indicates 16-bit unsigned integer Extended Length else -> 15 // Reserved, indicates 32-bit unsigned integer Extended Length }.toInt() - /* ktlint-enable no-multi-spaces */ val tkl = tokenLength.toInt() // |7 6 5 4 3 2 1 0| @@ -188,7 +187,7 @@ internal fun BufferedSink.writeHeader( writeByte((len shl 4) or tkl) // Extended Length (if any, as chosen by Len) ... - /* ktlint-disable no-multi-spaces */ + @Suppress("ktlint:standard:no-multi-spaces") when (len) { // |7 6 5 4 3 2 1 0| // +-+-+-+-+-+-+-+-+ @@ -208,7 +207,6 @@ internal fun BufferedSink.writeHeader( // +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 15 -> writeInt(contentLength - 65805) // 32-bit unsigned integer } - /* ktlint-enable no-multi-spaces */ // |7 6 5 4 3 2 1 0| // +-+-+-+-+-+-+-+-+ @@ -250,16 +248,15 @@ private fun BufferedSink.writeOptions(options: List