Skip to content

WIP: CareLevo driver#4742

Open
MilosKozak wants to merge 13 commits into
devfrom
carelevo
Open

WIP: CareLevo driver#4742
MilosKozak wants to merge 13 commits into
devfrom
carelevo

Fix merge

99d8bee
Select commit
Loading
Failed to load commit list.
SonarQubeCloud / SonarCloud Code Analysis failed May 15, 2026 in 4m 19s

Quality Gate failed

Failed conditions
3 Security Hotspots
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Annotations

Check warning on line 74 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/domain/usecase/userSetting/CarelevoUpdateLowInsulinNoticeAmountUseCase.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Replace this if expression with check(updateUserSettingInfoResult) { "update user setting info is failed" }.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix4O1bH6TsjJaUCp&open=AZ2xix4O1bH6TsjJaUCp&pullRequest=4742

Check warning on line 39 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/domain/usecase/patch/CarelevoPatchForceDiscardUseCase.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Replace this if expression with check(deletePatchInfoResult) { "delete patch info is failed" }.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix261bH6TsjJaUCF&open=AZ2xix261bH6TsjJaUCF&pullRequest=4742

Check warning on line 32 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/domain/usecase/infusion/CarelevoPumpStopUseCase.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Replace this if expression with require(request is CarelevoPumpStopRequestModel) { "request is not CarelevoPumpStopRequestModel" }.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2yBp15z-zbOMCy0BKH&open=AZ2yBp15z-zbOMCy0BKH&pullRequest=4742

Check warning on line 26 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/di/CarelevoModule.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Replace this abstract class with an interface, or add function implementations or state properties to the class.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2yBp3uz-zbOMCy0BKQ&open=AZ2yBp3uz-zbOMCy0BKQ&pullRequest=4742

Check failure on line 395 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/common/CarelevoPatch.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "response success" 4 times.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix8L1bH6TsjJaUDv&open=AZ2xix8L1bH6TsjJaUDv&pullRequest=4742

Check warning on line 52 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/domain/usecase/infusion/CarelevoPumpResumeUseCase.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Replace this if expression with check(updateInfusionInfoResult) { "update infusion info is failed" }.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2yBp11z-zbOMCy0BKF&open=AZ2yBp11z-zbOMCy0BKF&pullRequest=4742

Check warning on line 299 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/ext/AlarmExt.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Reduce the number of when branches from 36 to at most 30.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix_I1bH6TsjJaUEg&open=AZ2xix_I1bH6TsjJaUEg&pullRequest=4742

Check warning on line 9 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/data/protocol/transformer/CarelevoIntegerToByteTransformerImpl.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Replace this if expression with require(!(item !in minThreshold..maxThreshold && !(minThreshold == 0 && maxThreshold == 0))) { "$item is invalid. Integer value must be greater than $minThreshold, lower than $maxThreshold" }.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2yBplDz-zbOMCy0BJn&open=AZ2yBplDz-zbOMCy0BJn&pullRequest=4742

Check warning on line 154 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/domain/usecase/basal/CarelevoUpdateBasalProgramUseCase.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Replace this throw expression with error("Unexpected basal ack type").

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix2U1bH6TsjJaUBu&open=AZ2xix2U1bH6TsjJaUBu&pullRequest=4742

Check warning on line 685 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/presentation/viewmodel/CarelevoOverviewViewModel.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Either remove or fill this block of code.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix7w1bH6TsjJaUDm&open=AZ2xix7w1bH6TsjJaUDm&pullRequest=4742

Check failure on line 215 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/presentation/viewmodel/CarelevoPatchSafetyCheckViewModel.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "response failed" 3 times.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix6D1bH6TsjJaUDX&open=AZ2xix6D1bH6TsjJaUDX&pullRequest=4742

Check failure on line 26 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/domain/usecase/bolus/CarelevoCancelImmeBolusInfusionUseCase.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Refactor this method to reduce its Cognitive Complexity from 21 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix401bH6TsjJaUC8&open=AZ2xix401bH6TsjJaUC8&pullRequest=4742

Check warning on line 198 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/domain/model/bt/CarelevoProtocolChecker.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Reduce the number of when branches from 88 to at most 30.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix5O1bH6TsjJaUDI&open=AZ2xix5O1bH6TsjJaUDI&pullRequest=4742

Check warning on line 70 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/domain/usecase/userSetting/CarelevoUpdateMaxBolusDoseUseCase.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Replace this if expression with check(requestUpdateMaxBolusDoseResult.result == Result.SUCCESS) { "request update max bolus dose result is failed" }.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix4G1bH6TsjJaUCf&open=AZ2xix4G1bH6TsjJaUCf&pullRequest=4742

Check warning on line 69 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/coordinator/CarelevoBasalProfileUpdateCoordinator.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Replace this if expression with check(it.success) { "cancelExtendedBolus failed" }.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix9k1bH6TsjJaUD8&open=AZ2xix9k1bH6TsjJaUD8&pullRequest=4742

Check warning on line 96 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/domain/model/bt/CarelevoProtocolChecker.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

This condition duplicates the one on line 88.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix5O1bH6TsjJaUDK&open=AZ2xix5O1bH6TsjJaUDK&pullRequest=4742

Check warning on line 171 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/domain/usecase/basal/CarelevoUpdateBasalProgramUseCase.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Replace this if expression with check(requestProgram3Result == SetBasalProgramResult.SUCCESS) { "request update program3 result is failed" }.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix2U1bH6TsjJaUBp&open=AZ2xix2U1bH6TsjJaUBp&pullRequest=4742

Check warning on line 50 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/domain/usecase/bolus/CarelevoCancelImmeBolusInfusionUseCase.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Merge chained "if" statements into a single "when" statement.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix401bH6TsjJaUC9&open=AZ2xix401bH6TsjJaUC9&pullRequest=4742

Check warning on line 100 in implementation/src/main/kotlin/app/aaps/implementation/userEntry/UserEntryPresentationHelperImpl.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Reduce the number of when branches from 84 to at most 30.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xiyAn1bH6TsjJaUEj&open=AZ2xiyAn1bH6TsjJaUEj&pullRequest=4742

Check warning on line 143 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/domain/usecase/basal/CarelevoUpdateBasalProgramUseCase.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Replace this if expression with check(requestProgram2Result == SetBasalProgramResult.SUCCESS) { "request update program2 result is failed" }.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix2U1bH6TsjJaUBo&open=AZ2xix2U1bH6TsjJaUBo&pullRequest=4742

Check warning on line 60 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/domain/usecase/userSetting/CarelevoPatchExpiredThresholdModifyUseCase.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Either remove or fill this block of code.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2yBp1Oz-zbOMCy0BJ3&open=AZ2yBp1Oz-zbOMCy0BJ3&pullRequest=4742

Check warning on line 279 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/domain/model/bt/CarelevoProtocolChecker.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

This condition duplicates the one on line 271.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix5O1bH6TsjJaUDM&open=AZ2xix5O1bH6TsjJaUDM&pullRequest=4742

Check failure on line 210 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/ble/core/CarelevoBleMangerImpl.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Define a constant instead of duplicating this literal "bluetooth is not enabled" 11 times.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix-s1bH6TsjJaUEP&open=AZ2xix-s1bH6TsjJaUEP&pullRequest=4742

Check warning on line 217 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/presentation/viewmodel/CarelevoAlarmViewModel.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Use "_" instead of this unused lambda parameter "error".

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix7N1bH6TsjJaUDZ&open=AZ2xix7N1bH6TsjJaUDZ&pullRequest=4742

Check failure on line 605 in pump/carelevo/src/main/kotlin/app/aaps/pump/carelevo/ble/core/CarelevoBleMangerImpl.kt

See this annotation in the file changed.

@sonarqubecloud sonarqubecloud / SonarCloud Code Analysis

Refactor this method to reduce its Cognitive Complexity from 29 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=nightscout_AndroidAPS&issues=AZ2xix-s1bH6TsjJaUET&open=AZ2xix-s1bH6TsjJaUET&pullRequest=4742