diff --git a/.editorconfig b/.editorconfig index af88a4bc9..a3cbcc961 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,23 @@ [*.{kt,kts}] ij_kotlin_allow_trailing_comma = true ij_kotlin_allow_trailing_comma_on_call_site = true + +ktlint_standard_blank-line-before-declaration = disabled ktlint_standard_filename = disabled +ktlint_standard_function-naming = disabled +ktlint_standard_function-signature = disabled +ktlint_standard_no-blank-line-in-list = disabled +ktlint_standard_no-empty-first-line-in-class-body = disabled +ktlint_standard_no-single-line-block-comment = disabled +ktlint_standard_property-naming = disabled +ktlint_standard_property-wrapping = disabled +ktlint_standard_statement-wrapping = 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 + +[**/*Test/kotlin/**/*.{kt,kts}] +# `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/core/src/androidMain/kotlin/WriteNotificationDescriptor.kt b/core/src/androidMain/kotlin/WriteNotificationDescriptor.kt index 746adc967..69f520bfa 100644 --- a/core/src/androidMain/kotlin/WriteNotificationDescriptor.kt +++ b/core/src/androidMain/kotlin/WriteNotificationDescriptor.kt @@ -2,7 +2,8 @@ package com.juul.kable /** Mode specifying if config descriptor (0x2902) should be written to when starting/stopping an observation. */ @Deprecated( - message = "Writing notification descriptor is handled automatically by 'observe' function. This class is no longer used and will be removed in a future release.", + message = "Writing notification descriptor is handled automatically by 'observe' function. " + + "This class is no longer used and will be removed in a future release.", level = DeprecationLevel.HIDDEN, ) public enum class WriteNotificationDescriptor { diff --git a/core/src/appleMain/kotlin/CentralManagerCoreBluetoothScanner.kt b/core/src/appleMain/kotlin/CentralManagerCoreBluetoothScanner.kt index 599e1897f..02038256f 100644 --- a/core/src/appleMain/kotlin/CentralManagerCoreBluetoothScanner.kt +++ b/core/src/appleMain/kotlin/CentralManagerCoreBluetoothScanner.kt @@ -39,6 +39,7 @@ internal class CentralManagerCoreBluetoothScanner( init { if (!nativeServiceFiltering) { logger.warn { + @Suppress("ktlint:standard:max-line-length") message = "According to Core Bluetooth documentation: " + "\"The recommended practice is to populate the serviceUUIDs parameter rather than leaving it nil.\" " + "This means providing only (and at least 1) filter(s) of type `Filter.Service` to Scanner. " + @@ -66,8 +67,11 @@ internal class CentralManagerCoreBluetoothScanner( } .filterIsInstance() .filter { didDiscoverPeripheral -> - if (nativeServiceFiltering) return@filter true // Short-circuit (i.e. don't filter) when scan is using native service filtering. - if (filters.isEmpty()) return@filter true // Short-circuit (i.e. don't filter) if no filters were provided. + // Short-circuit (i.e. don't filter) when scan is using native service filtering. + if (nativeServiceFiltering) return@filter true + + // Short-circuit (i.e. don't filter) if no filters were provided. + if (filters.isEmpty()) return@filter true val advertisementData = didDiscoverPeripheral.advertisementData.asAdvertisementData() filters.any { filter -> diff --git a/core/src/appleMain/kotlin/CentralManagerDelegate.kt b/core/src/appleMain/kotlin/CentralManagerDelegate.kt index b208431f1..f81c4d7ff 100644 --- a/core/src/appleMain/kotlin/CentralManagerDelegate.kt +++ b/core/src/appleMain/kotlin/CentralManagerDelegate.kt @@ -76,7 +76,8 @@ internal class CentralManagerDelegate : NSObject(), CBCentralManagerDelegateProt _connectionState.emitBlocking(DidConnect(didConnectPeripheral.identifier)) } - @Suppress("CONFLICTING_OVERLOADS") // https://kotlinlang.org/docs/reference/native/objc_interop.html#subclassing-swiftobjective-c-classes-and-protocols-from-kotlin + // https://kotlinlang.org/docs/reference/native/objc_interop.html#subclassing-swiftobjective-c-classes-and-protocols-from-kotlin + @Suppress("CONFLICTING_OVERLOADS") override fun centralManager( central: CBCentralManager, didDisconnectPeripheral: CBPeripheral, @@ -86,7 +87,8 @@ internal class CentralManagerDelegate : NSObject(), CBCentralManagerDelegateProt _connectionState.emitBlocking(DidDisconnect(didDisconnectPeripheral.identifier, error)) } - @Suppress("CONFLICTING_OVERLOADS") // https://kotlinlang.org/docs/reference/native/objc_interop.html#subclassing-swiftobjective-c-classes-and-protocols-from-kotlin + // https://kotlinlang.org/docs/reference/native/objc_interop.html#subclassing-swiftobjective-c-classes-and-protocols-from-kotlin + @Suppress("CONFLICTING_OVERLOADS") override fun centralManager( central: CBCentralManager, didFailToConnectPeripheral: CBPeripheral, @@ -121,9 +123,10 @@ internal class CentralManagerDelegate : NSObject(), CBCentralManagerDelegateProt } override fun centralManager(central: CBCentralManager, willRestoreState: Map) { - // No-op: From the documentation: Tells the delegate the system is about to restore the central manager, as part of relaunching the app into the background. - // Use this method to synchronize the state of your app with the state of the Bluetooth system. - // Since the rest of Kable is handling the "synchronize," there's nothing to do here. + // No-op: From the documentation: Tells the delegate the system is about to restore the + // central manager, as part of relaunching the app into the background. Use this method to + // synchronize the state of your app with the state of the Bluetooth system. Since the rest + // of Kable is handling the "synchronize," there's nothing to do here. } /* Monitoring the Central Manager’s Authorization */ diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 17de8d094..3ad01232d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -23,6 +23,6 @@ android-library = { id = "com.android.library", version = "8.1.2" } atomicfu = { id = "kotlinx-atomicfu", version.ref = "atomicfu" } dokka = { id = "org.jetbrains.dokka", version = "1.9.10" } 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" } maven-publish = { id = "com.vanniktech.maven.publish", version = "0.25.3" } validator = { id = "binary-compatibility-validator", version = "0.13.0" }