diff --git a/.editorconfig b/.editorconfig index 91fe5a0e..b7abc6a7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,3 +1,15 @@ [*.{kt,kts}] ij_kotlin_allow_trailing_comma = true ij_kotlin_allow_trailing_comma_on_call_site = true + +ktlint_standard_function-signature = disabled +ktlint_standard_no-blank-line-in-list = disabled +ktlint_standard_no-empty-first-line-in-class-body = disabled + +# `string-template-indent` is disabled because it depends on `multiline-expression-wrapping`. +ktlint_standard_multiline-expression-wrapping = disabled +ktlint_standard_string-template-indent = disabled + +# `if-else-wrapping` is disabled because it depends on `discouraged-comment-location`. +ktlint_standard_discouraged-comment-location = disabled +ktlint_standard_if-else-wrapping = disabled diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b15ab41b..dc0cefcd 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.9.10" } 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.16.0" } +kotlinter = { id = "org.jmailen.kotlinter", version = "4.0.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/ByteArrayReader.kt b/koap/src/commonMain/kotlin/ByteArrayReader.kt index ae21541e..52f5ec54 100644 --- a/koap/src/commonMain/kotlin/ByteArrayReader.kt +++ b/koap/src/commonMain/kotlin/ByteArrayReader.kt @@ -26,6 +26,7 @@ internal class ByteArrayReader( ) { var index = startIndex + fun exhausted(): Boolean = index >= endIndex private fun checkIndex() { diff --git a/koap/src/commonMain/kotlin/Decoder.kt b/koap/src/commonMain/kotlin/Decoder.kt index 08051142..718eb79a 100644 --- a/koap/src/commonMain/kotlin/Decoder.kt +++ b/koap/src/commonMain/kotlin/Decoder.kt @@ -451,6 +451,7 @@ private fun Int.toCode(): Message.Code = when (this) { 165 -> ProxyingNotSupported // 5.05 else -> { + @Suppress("ktlint:standard:property-naming") // ktlint doesn't properly handle the ticks. val `class` = (this shr 5) and 0b111 val detail = this and 0b11111 Message.Code.Raw(`class`, detail) diff --git a/koap/src/commonMain/kotlin/Encoder.kt b/koap/src/commonMain/kotlin/Encoder.kt index a2244a18..9bbc5599 100644 --- a/koap/src/commonMain/kotlin/Encoder.kt +++ b/koap/src/commonMain/kotlin/Encoder.kt @@ -337,7 +337,9 @@ internal fun BufferedSink.writeToken(token: Long) { } private fun BufferedSink.writeByte(byte: Long) = writeByte(byte.toInt()) + private fun BufferedSink.writeShort(short: Long) = writeShort(short.toInt()) + private fun BufferedSink.writeInt(int: Long) = writeInt(int.toInt()) // Type (T): 2-bit unsigned integer diff --git a/koap/src/commonMain/kotlin/Message.kt b/koap/src/commonMain/kotlin/Message.kt index 2f985463..551027b5 100644 --- a/koap/src/commonMain/kotlin/Message.kt +++ b/koap/src/commonMain/kotlin/Message.kt @@ -336,6 +336,7 @@ sealed class Message { */ sealed class Code { + @Suppress("ktlint:standard:property-naming") // ktlint doesn't properly handle the ticks. abstract val `class`: Int abstract val detail: Int