Skip to content

Commit

Permalink
update detekt config / minimal formatting adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
ened committed Apr 7, 2024
1 parent aeb0350 commit 1398013
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 38 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[*.{kt,kts}]
max_line_length=210
ktlint_standard_property-naming=disabled
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
run: |
./bin/quality_checks.sh
- name: Build android app & run native tests
- name: Build Android app & run native tests
run: |
#!/bin/bash -ex
cd example
Expand Down
59 changes: 32 additions & 27 deletions example/android/config/detekt/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,22 @@ complexity:
active: false
threshold: 10
includeStaticDeclarations: false
ComplexMethod:
CyclomaticComplexMethod:
active: true
threshold: 15
ignoreSingleWhenExpression: false
ignoreSimpleWhenEntries: false
ignoreNestingFunctions: false
nestingFunctions: run,let,apply,with,also,use,forEach,isNotNull,ifNull
nestingFunctions:
- run
- let
- apply
- with
- also
- use
- forEach
- isNotNull
- ifNull
LabeledExpression:
active: false
ignoredLabels: []
Expand All @@ -79,7 +88,8 @@ complexity:
threshold: 60
LongParameterList:
active: true
threshold: 6
functionThreshold: 6
constructorThreshold: 6
ignoreDefaultParameters: false
MethodOverloading:
active: false
Expand Down Expand Up @@ -135,7 +145,7 @@ empty-blocks:
active: true
EmptyFunctionBlock:
active: true
ignoreOverriddenFunctions: false
ignoreOverridden: false
EmptyIfBlock:
active: true
EmptyInitBlock:
Expand Down Expand Up @@ -246,7 +256,6 @@ formatting:
active: false
autoCorrect: true
indentSize: 4
continuationIndentSize: 4
MaximumLineLength:
active: false
maxLineLength: 230
Expand Down Expand Up @@ -294,7 +303,7 @@ formatting:
ParameterListWrapping:
active: true
autoCorrect: false
indentSize: 0
indentSize: 4
SpacingAroundColon:
active: true
autoCorrect: true
Expand Down Expand Up @@ -345,7 +354,6 @@ naming:
parameterPattern: '[a-z][A-Za-z0-9]*'
privateParameterPattern: '[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true
EnumNaming:
active: true
excludes:
Expand Down Expand Up @@ -392,7 +400,6 @@ naming:
- "**/*.Spek.kt"
functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
excludeClassPattern: '$^'
ignoreOverridden: true
FunctionParameterNaming:
active: true
excludes:
Expand All @@ -403,15 +410,14 @@ naming:
- "**/*.Spek.kt"
parameterPattern: '[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
ignoreOverriddenFunctions: true
InvalidPackageDeclaration:
active: false
rootPackage: ''
MatchingDeclarationName:
active: true
MemberNameEqualsClassName:
active: true
ignoreOverriddenFunction: true
ignoreOverridden: true
ObjectPropertyNaming:
active: true
excludes:
Expand Down Expand Up @@ -472,7 +478,6 @@ naming:
variablePattern: '[a-z][A-Za-z0-9]*'
privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true

performance:
active: true
Expand Down Expand Up @@ -501,8 +506,6 @@ potential-bugs:
active: true
Deprecation:
active: false
DuplicateCaseInWhenExpression:
active: true
EqualsAlwaysReturnsTrueOrFalse:
active: true
EqualsWithHashCodeExist:
Expand All @@ -527,12 +530,8 @@ potential-bugs:
- "**/*.Test.kt"
- "**/*.Spec.kt"
- "**/*.Spek.kt"
excludeAnnotatedProperties: ""
ignoreAnnotated: []
ignoreOnClassesPattern: ""
MissingWhenCase:
active: true
RedundantElseInWhen:
active: true
UnconditionalJumpStatementInLoop:
active: false
UnreachableCode:
Expand All @@ -548,6 +547,10 @@ potential-bugs:

style:
active: true
BracesOnIfStatements:
active: true
singleLine: 'never'
multiLine: 'always'
CollapsibleIfStatements:
active: false
DataClassContainsFunctions:
Expand All @@ -567,7 +570,7 @@ style:
includeLineWrapping: false
ForbiddenComment:
active: true
values:
comments:
- 'TODO:'
- 'FIXME:'
- 'STOPSHIP:'
Expand All @@ -585,9 +588,8 @@ style:
ignoreOverridableFunction: true
excludedFunctions:
- 'describeContents'
excludeAnnotatedFunction: "dagger.Provides"
LibraryCodeMustSpecifyReturnType:
active: true
ignoreAnnotated:
- "dagger.Provides"
LoopWithTooManyJumpStatements:
active: true
maxJumpCount: 1
Expand All @@ -609,8 +611,6 @@ style:
ignoreNamedArgument: true
ignoreEnums: false
ignoreRanges: false
MandatoryBracesIfStatements:
active: false
MaxLineLength:
autoCorrect: false
active: false
Expand Down Expand Up @@ -662,10 +662,11 @@ style:
active: false
UnderscoresInNumericLiterals:
active: false
acceptableDecimalLength: 5
acceptableLength: 5
UnnecessaryAbstractClass:
active: true
excludeAnnotatedClasses: "dagger.Module"
ignoreAnnotated:
- "dagger.Module"
UnnecessaryApply:
active: false
UnnecessaryInheritance:
Expand All @@ -689,7 +690,7 @@ style:
active: false
UseDataClass:
active: false
excludeAnnotatedClasses: ""
ignoreAnnotated: []
allowVars: false
UseIfInsteadOfWhen:
active: false
Expand All @@ -712,3 +713,7 @@ style:
excludeImports:
- 'java.util.*'
- 'kotlinx.android.synthetic.*'

libraries:
LibraryCodeMustSpecifyReturnType:
active: true
7 changes: 4 additions & 3 deletions packages/reactive_ble_mobile/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ buildscript {

dependencies {
classpath 'com.android.tools.build:gradle:8.0.2'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.3'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detekt_version"
classpath "de.mannodermaus.gradle.plugins:android-junit5:1.7.1.1"
Expand Down Expand Up @@ -76,12 +76,13 @@ detekt {
input = files("src/main/kotlin")
dependencies {
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:$detekt_version"
detektPlugins "io.gitlab.arturbosch.detekt:detekt-rules-libraries:$detekt_version"
}
}

protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.23.0'
artifact = 'com.google.protobuf:protoc:3.25.3'
}

generateProtoTasks {
Expand All @@ -98,7 +99,7 @@ protobuf {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.polidea.rxandroidble2:rxandroidble:1.16.0'
implementation 'com.google.protobuf:protobuf-javalite:3.23.0'
implementation 'com.google.protobuf:protobuf-javalite:3.25.3'
implementation 'io.reactivex.rxjava2:rxkotlin:2.4.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ package com.signify.hue.flutterreactiveble.ble
import com.polidea.rxandroidble2.RxBleConnection
import java.util.UUID

data class ScanInfo(val deviceId: String, val name: String, val rssi: Int, val connectable: Connectable, val serviceData: Map<UUID, ByteArray>, val serviceUuids: List<UUID>, val manufacturerData: ByteArray) {
data class ScanInfo(
val deviceId: String,
val name: String,
val rssi: Int,
val connectable: Connectable,
val serviceData: Map<UUID, ByteArray>,
val serviceUuids: List<UUID>,
val manufacturerData: ByteArray,
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import com.signify.hue.flutterreactiveble.ProtobufModel as pb

class ScanDevicesHandler(private val bleClient: com.signify.hue.flutterreactiveble.ble.BleClient) : EventChannel.StreamHandler {
class ScanDevicesHandler(
private val bleClient: com.signify.hue.flutterreactiveble.ble.BleClient,
) : EventChannel.StreamHandler {
private var scanDevicesSink: EventChannel.EventSink? = null
private lateinit var scanForDevicesDisposable: Disposable
private val converter = ProtobufMessageConverter()
Expand Down Expand Up @@ -76,4 +78,8 @@ class ScanDevicesHandler(private val bleClient: com.signify.hue.flutterreactiveb
}
}

private data class ScanParameters(val filter: List<ParcelUuid>, val mode: ScanMode, val locationServiceIsMandatory: Boolean)
private data class ScanParameters(
val filter: List<ParcelUuid>,
val mode: ScanMode,
val locationServiceIsMandatory: Boolean,
)
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ import org.junit.jupiter.api.Test
import java.util.UUID
import java.util.concurrent.TimeUnit

private class BleClientForTesting(val bleClient: RxBleClient, appContext: Context, val deviceConnector: DeviceConnector) : ReactiveBleClient(
appContext,
) {
private class BleClientForTesting(
val bleClient: RxBleClient,
appContext: Context,
val deviceConnector: DeviceConnector,
) : ReactiveBleClient(
appContext,
) {
override fun initializeClient() {
rxBleClient = bleClient
activeConnections = mutableMapOf()
Expand Down

0 comments on commit 1398013

Please sign in to comment.