diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d646ce6d6..57446f549 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -11,6 +11,7 @@ plugins { alias(libs.plugins.firebase.appdistribution) alias(libs.plugins.firebase.crashlytics) alias(libs.plugins.palantir.git) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/benchmark/build.gradle.kts b/benchmark/build.gradle.kts index 2ec3e47cb..fa9a2ede9 100644 --- a/benchmark/build.gradle.kts +++ b/benchmark/build.gradle.kts @@ -2,6 +2,7 @@ plugins { id("com.android.test") id("org.jetbrains.kotlin.android") id("kotlin-android") + alias(libs.plugins.detekt) } android { diff --git a/build.gradle.kts b/build.gradle.kts index 74b824c07..cf6978d11 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -13,4 +13,8 @@ plugins { alias(libs.plugins.spotless) alias(libs.plugins.detekt) alias(libs.plugins.palantir.git) +} + +detekt { + config.setFrom("$projectDir/config/detekt/detekt.yml") } \ No newline at end of file diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index fd1a9102d..ada0a65cf 100644 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -48,6 +48,7 @@ output-reports: # - 'XmlOutputReport' # - 'HtmlOutputReport' # - 'MdOutputReport' + # - 'SarifOutputReport' comments: active: true @@ -66,7 +67,7 @@ comments: endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)' KDocReferencesNonPublicProperty: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] OutdatedDocumentation: active: false matchTypeParameters: true @@ -74,7 +75,7 @@ comments: allowParamOnConstructorProperties: false UndocumentedPublicClass: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] searchInNestedClass: true searchInInnerClass: true searchInInnerObject: true @@ -82,11 +83,11 @@ comments: searchInProtectedClass: false UndocumentedPublicFunction: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] searchProtectedFunction: false UndocumentedPublicProperty: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] searchProtectedProperty: false complexity: @@ -126,10 +127,10 @@ complexity: active: true threshold: 600 LongMethod: - active: true + active: false threshold: 60 LongParameterList: - active: true + active: false functionThreshold: 6 constructorThreshold: 7 ignoreDefaultParameters: false @@ -158,14 +159,14 @@ complexity: active: false StringLiteralDuplication: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] threshold: 3 ignoreAnnotation: true excludeStringsWithLessThan5Characters: true ignoreStringsRegex: '$^' TooManyFunctions: - active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] thresholdInFiles: 11 thresholdInClasses: 11 thresholdInInterfaces: 11 @@ -189,6 +190,8 @@ coroutines: active: true SleepInsteadOfDelay: active: true + SuspendFunSwallowedCancellation: + active: false SuspendFunWithCoroutineScopeReceiver: active: false SuspendFunWithFlowReturnType: @@ -240,7 +243,7 @@ exceptions: - 'toString' InstanceOfCheckForException: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] NotImplementedDeclaration: active: false ObjectExtendsThrowable: @@ -266,7 +269,7 @@ exceptions: active: false ThrowingExceptionsWithoutMessageOrCause: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] exceptions: - 'ArrayIndexOutOfBoundsException' - 'Exception' @@ -280,8 +283,8 @@ exceptions: ThrowingNewInstanceOfSameException: active: true TooGenericExceptionCaught: - active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] exceptionNames: - 'ArrayIndexOutOfBoundsException' - 'Error' @@ -305,7 +308,6 @@ naming: BooleanPropertyNaming: active: false allowedPattern: '^(is|has|are)' - ignoreOverridden: true ClassNaming: active: true classPattern: '[A-Z][a-zA-Z0-9]*' @@ -314,7 +316,6 @@ naming: parameterPattern: '[a-z][A-Za-z0-9]*' privateParameterPattern: '[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' - ignoreOverridden: true EnumNaming: active: true enumEntryPattern: '[A-Z][_a-zA-Z0-9]*' @@ -328,16 +329,14 @@ naming: active: false minimumFunctionNameLength: 3 FunctionNaming: - active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] functionPattern: '[a-z][a-zA-Z0-9]*' excludeClassPattern: '$^' - ignoreOverridden: true FunctionParameterNaming: active: true parameterPattern: '[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' - ignoreOverridden: true InvalidPackageDeclaration: active: true rootPackage: '' @@ -349,7 +348,7 @@ naming: active: true mustBeFirst: true MemberNameEqualsClassName: - active: true + active: false ignoreOverridden: true NoNameShadowing: active: true @@ -379,7 +378,6 @@ naming: variablePattern: '[a-z][A-Za-z0-9]*' privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' - ignoreOverridden: true performance: active: true @@ -390,10 +388,10 @@ performance: threshold: 3 ForEachOnRange: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] SpreadOperator: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] UnnecessaryPartOfBinaryExpression: active: false UnnecessaryTemporaryInstantiation: @@ -405,6 +403,8 @@ potential-bugs: active: true forbiddenTypePatterns: - 'kotlin.String' + CastNullableToNonNullableType: + active: false CastToNullableType: active: false Deprecation: @@ -424,6 +424,7 @@ potential-bugs: - 'java.util.HashMap' ElseCaseInsteadOfExhaustiveWhen: active: false + ignoredSubjectTypes: [] EqualsAlwaysReturnsTrueOrFalse: active: true EqualsWithHashCodeExist: @@ -438,9 +439,12 @@ potential-bugs: active: true restrictToConfig: true returnValueAnnotations: + - 'CheckResult' - '*.CheckResult' + - 'CheckReturnValue' - '*.CheckReturnValue' ignoreReturnValueAnnotations: + - 'CanIgnoreReturnValue' - '*.CanIgnoreReturnValue' returnValueTypes: - 'kotlin.sequences.Sequence' @@ -460,7 +464,7 @@ potential-bugs: active: true LateinitUsage: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] ignoreOnClassesPattern: '' MapGetWithNotNullAssertionOperator: active: true @@ -471,6 +475,8 @@ potential-bugs: active: false NullableToStringCall: active: false + PropertyUsedBeforeDeclaration: + active: false UnconditionalJumpStatementInLoop: active: false UnnecessaryNotNullCheck: @@ -485,7 +491,7 @@ potential-bugs: active: true UnsafeCallOnNullableType: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**'] UnsafeCast: active: true UnusedUnaryOperator: @@ -499,6 +505,14 @@ style: active: true AlsoCouldBeApply: active: false + BracesOnIfStatements: + active: false + singleLine: 'never' + multiLine: 'always' + BracesOnWhenStatements: + active: false + singleLine: 'necessary' + multiLine: 'consistent' CanBeNonNullable: active: false CascadingCallWrapping: @@ -512,11 +526,22 @@ style: active: false conversionFunctionPrefix: - 'to' + allowOperators: false DataClassShouldBeImmutable: active: false DestructuringDeclarationWithTooManyEntries: - active: true + active: false maxDestructuringEntries: 3 + DoubleNegativeLambda: + active: false + negativeFunctions: + - reason: 'Use `takeIf` instead.' + value: 'takeUnless' + - reason: 'Use `all` instead.' + value: 'none' + negativeFunctionNameParts: + - 'not' + - 'non' EqualsNullCall: active: true EqualsOnSignatureLine: @@ -528,14 +553,33 @@ style: ExpressionBodySyntax: active: false includeLineWrapping: false + ForbiddenAnnotation: + active: false + annotations: + - reason: 'it is a java annotation. Use `Suppress` instead.' + value: 'java.lang.SuppressWarnings' + - reason: 'it is a java annotation. Use `kotlin.Deprecated` instead.' + value: 'java.lang.Deprecated' + - reason: 'it is a java annotation. Use `kotlin.annotation.MustBeDocumented` instead.' + value: 'java.lang.annotation.Documented' + - reason: 'it is a java annotation. Use `kotlin.annotation.Target` instead.' + value: 'java.lang.annotation.Target' + - reason: 'it is a java annotation. Use `kotlin.annotation.Retention` instead.' + value: 'java.lang.annotation.Retention' + - reason: 'it is a java annotation. Use `kotlin.annotation.Repeatable` instead.' + value: 'java.lang.annotation.Repeatable' + - reason: 'Kotlin does not support @Inherited annotation, see https://youtrack.jetbrains.com/issue/KT-22265' + value: 'java.lang.annotation.Inherited' ForbiddenComment: active: true - values: - - 'FIXME:' - - 'STOPSHIP:' - - 'TODO:' + comments: + - reason: 'Forbidden FIXME todo marker in comment, please fix the problem.' + value: 'FIXME:' + - reason: 'Forbidden STOPSHIP todo marker in comment, please address the problem before shipping the code.' + value: 'STOPSHIP:' + - reason: 'Forbidden TODO todo marker in comment, please do the changes.' + value: 'TODO:' allowedPatterns: '' - customMessage: '' ForbiddenImport: active: false imports: [] @@ -563,13 +607,20 @@ style: active: true maxJumpCount: 1 MagicNumber: - active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**', '**/*.kts'] + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**', '**/*.kts'] ignoreNumbers: - '-1' - '0' - '1' - '2' + - '21' + - '26' + - '28' + - '29' + - '30' + - '31' + - '33' ignoreHashCodeFunction: true ignorePropertyDeclaration: false ignoreLocalVariableDeclaration: false @@ -580,15 +631,13 @@ style: ignoreEnums: false ignoreRanges: false ignoreExtensionFunctions: true - MandatoryBracesIfStatements: - active: false MandatoryBracesLoops: active: false MaxChainedCallsOnSameLine: active: false maxChainedCalls: 5 MaxLineLength: - active: true + active: false maxLineLength: 120 excludePackageStatements: true excludeImportStatements: true @@ -603,10 +652,13 @@ style: MultilineRawStringIndentation: active: false indentSize: 4 + trimmingMethods: + - 'trimIndent' + - 'trimMargin' NestedClassesVisibility: active: true NewLineAtEndOfFile: - active: true + active: false NoTabs: active: false NullableBooleanCheck: @@ -617,8 +669,6 @@ style: active: true OptionalUnit: active: false - OptionalWhenBraces: - active: false PreferToOverPairSyntax: active: false ProtectedMemberInFinalClass: @@ -631,7 +681,7 @@ style: active: false ReturnCount: active: true - max: 2 + max: 3 excludedFunctions: - 'equals' excludeLabeled: false @@ -643,6 +693,10 @@ style: active: true SpacingBetweenPackageAndImports: active: false + StringShouldBeRawString: + active: false + maxEscapedCharacterCount: 2 + ignoredCharacters: [] ThrowsCount: active: true max: 2 @@ -651,6 +705,9 @@ style: active: false TrimMultilineRawString: active: false + trimmingMethods: + - 'trimIndent' + - 'trimMargin' UnderscoresInNumericLiterals: active: false acceptableLength: 4 @@ -663,6 +720,8 @@ style: active: true UnnecessaryBackticks: active: false + UnnecessaryBracesAroundTrailingLambda: + active: false UnnecessaryFilter: active: true UnnecessaryInheritance: @@ -677,12 +736,18 @@ style: UntilInsteadOfRangeTo: active: false UnusedImports: - active: false + active: true + UnusedParameter: + active: true + allowedNames: 'ignored|expected' UnusedPrivateClass: active: true UnusedPrivateMember: - active: true - allowedNames: '(_|ignored|expected|serialVersionUID)' + active: false + allowedNames: '' + UnusedPrivateProperty: + active: false + allowedNames: '_|ignored|expected|serialVersionUID' UseAnyOrNoneInsteadOfFind: active: true UseArrayLiteralsInAnnotations: @@ -700,8 +765,11 @@ style: active: false UseIfInsteadOfWhen: active: false + ignoreWhenContainingVariableDeclaration: false UseIsNullOrEmpty: active: true + UseLet: + active: false UseOrEmpty: active: true UseRequire: diff --git a/core/analytics/build.gradle.kts b/core/analytics/build.gradle.kts index 0f8374f9e..249203833 100644 --- a/core/analytics/build.gradle.kts +++ b/core/analytics/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/core/common/build.gradle.kts b/core/common/build.gradle.kts index b5401835a..a04e86799 100644 --- a/core/common/build.gradle.kts +++ b/core/common/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/core/common/src/main/kotlin/org/michaelbel/movies/common/localization/exceptions/InvalidLocaleException.kt b/core/common/src/main/kotlin/org/michaelbel/movies/common/localization/exceptions/InvalidLocaleException.kt index 5f85a02e7..5e727b985 100644 --- a/core/common/src/main/kotlin/org/michaelbel/movies/common/localization/exceptions/InvalidLocaleException.kt +++ b/core/common/src/main/kotlin/org/michaelbel/movies/common/localization/exceptions/InvalidLocaleException.kt @@ -2,4 +2,5 @@ package org.michaelbel.movies.common.localization.exceptions internal data object InvalidLocaleException: Exception("Invalid locale") { private fun readResolve(): Any = InvalidLocaleException + } \ No newline at end of file diff --git a/core/domain/build.gradle.kts b/core/domain/build.gradle.kts index 7a7826f85..a7a0cc369 100644 --- a/core/domain/build.gradle.kts +++ b/core/domain/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/core/domain/src/main/kotlin/org/michaelbel/movies/domain/workers/AccountUpdateWorker.kt b/core/domain/src/main/kotlin/org/michaelbel/movies/domain/workers/AccountUpdateWorker.kt index 1764d81f2..5718ccead 100644 --- a/core/domain/src/main/kotlin/org/michaelbel/movies/domain/workers/AccountUpdateWorker.kt +++ b/core/domain/src/main/kotlin/org/michaelbel/movies/domain/workers/AccountUpdateWorker.kt @@ -33,7 +33,7 @@ class AccountUpdateWorker @AssistedInject constructor( interactor.accountDetails() } Result.success() - } catch (e: Exception) { + } catch (ignored: Exception) { Result.failure() } } diff --git a/core/domain/src/main/kotlin/org/michaelbel/movies/domain/workers/MoviesDatabaseWorker.kt b/core/domain/src/main/kotlin/org/michaelbel/movies/domain/workers/MoviesDatabaseWorker.kt index 7638139b7..07b6b782f 100644 --- a/core/domain/src/main/kotlin/org/michaelbel/movies/domain/workers/MoviesDatabaseWorker.kt +++ b/core/domain/src/main/kotlin/org/michaelbel/movies/domain/workers/MoviesDatabaseWorker.kt @@ -42,7 +42,7 @@ class MoviesDatabaseWorker @AssistedInject constructor( } } Result.success() - } catch (e: Exception) { + } catch (ignored: Exception) { Result.failure() } } diff --git a/core/entities/build.gradle.kts b/core/entities/build.gradle.kts index 522f3286f..e6f270f0c 100644 --- a/core/entities/build.gradle.kts +++ b/core/entities/build.gradle.kts @@ -4,6 +4,7 @@ import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/core/entities/src/main/kotlin/org/michaelbel/movies/entities/Either.kt b/core/entities/src/main/kotlin/org/michaelbel/movies/entities/Either.kt index 090b7e31d..25a51f916 100644 --- a/core/entities/src/main/kotlin/org/michaelbel/movies/entities/Either.kt +++ b/core/entities/src/main/kotlin/org/michaelbel/movies/entities/Either.kt @@ -55,24 +55,6 @@ val Either.data: T? val Either.throwable: Throwable? get() = (this as? Either.Failure)?.exception -/** - * Unwrap and receive the success result data or do a function with *return* - * ```kotlin - * val data = useCase.getData() - * .takeOrReturn { - * Log.d("LOG", "it is an error again") - * return - * } - * ``` - */ -inline fun Either.takeOrReturn(f: (Throwable) -> Unit): T = when (this) { - is Either.Success -> this.value - is Either.Failure -> { - f(this.exception) - throw IllegalStateException("You must write 'return' in the failure lambda") - } -} - /** * Unwrap and receive the success result data or receive the default value in failure case * ```kotlin diff --git a/core/interactor-impl/build.gradle.kts b/core/interactor-impl/build.gradle.kts index abecbdf2a..5342207f9 100644 --- a/core/interactor-impl/build.gradle.kts +++ b/core/interactor-impl/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/core/interactor/build.gradle.kts b/core/interactor/build.gradle.kts index b78cf115a..e831f8927 100644 --- a/core/interactor/build.gradle.kts +++ b/core/interactor/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/core/navigation/build.gradle.kts b/core/navigation/build.gradle.kts index 9a6d6b17a..22ae83b00 100644 --- a/core/navigation/build.gradle.kts +++ b/core/navigation/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) } android { diff --git a/core/network/build.gradle.kts b/core/network/build.gradle.kts index f3f670fd2..085c08be3 100644 --- a/core/network/build.gradle.kts +++ b/core/network/build.gradle.kts @@ -3,6 +3,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) alias(libs.plugins.kotlin.serialization) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/core/network/src/main/kotlin/org/michaelbel/movies/network/chucker/ChuckerModule.kt b/core/network/src/main/kotlin/org/michaelbel/movies/network/chucker/ChuckerModule.kt index 6327ca88d..757d8c47d 100644 --- a/core/network/src/main/kotlin/org/michaelbel/movies/network/chucker/ChuckerModule.kt +++ b/core/network/src/main/kotlin/org/michaelbel/movies/network/chucker/ChuckerModule.kt @@ -25,8 +25,10 @@ internal object ChuckerModule { ) return ChuckerInterceptor.Builder(context) .collector(chuckerCollector) - .maxContentLength(250_000L) + .maxContentLength(MAX_CONTENT_LENGTH) .alwaysReadResponseBody(true) .build() } + + private const val MAX_CONTENT_LENGTH = 250_000L } \ No newline at end of file diff --git a/core/notifications/build.gradle.kts b/core/notifications/build.gradle.kts index 98336be6e..f7c2af955 100644 --- a/core/notifications/build.gradle.kts +++ b/core/notifications/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/core/notifications/src/main/kotlin/org/michaelbel/movies/notifications/MoviesMessagingService.kt b/core/notifications/src/main/kotlin/org/michaelbel/movies/notifications/MoviesMessagingService.kt index 9034e9dd5..702a55f26 100644 --- a/core/notifications/src/main/kotlin/org/michaelbel/movies/notifications/MoviesMessagingService.kt +++ b/core/notifications/src/main/kotlin/org/michaelbel/movies/notifications/MoviesMessagingService.kt @@ -14,11 +14,7 @@ internal class MoviesMessagingService: FirebaseMessagingService() { @Inject lateinit var notificationClient: NotificationClient - override fun onNewToken(token: String) {} - override fun onMessageReceived(message: RemoteMessage) { notificationClient.send(message.mapToMoviesPush) } - - override fun onDeletedMessages() {} } \ No newline at end of file diff --git a/core/persistence/build.gradle.kts b/core/persistence/build.gradle.kts index 48634fdb5..17cf3065f 100644 --- a/core/persistence/build.gradle.kts +++ b/core/persistence/build.gradle.kts @@ -3,6 +3,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) alias(libs.plugins.kotlin.ksp) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/core/repository-impl/build.gradle.kts b/core/repository-impl/build.gradle.kts index 86d02e9d0..dc3508778 100644 --- a/core/repository-impl/build.gradle.kts +++ b/core/repository-impl/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/core/repository-impl/src/main/kotlin/org/michaelbel/movies/repository/AccountRepositoryImpl.kt b/core/repository-impl/src/main/kotlin/org/michaelbel/movies/repository/AccountRepositoryImpl.kt index 3169009bf..5c5df7242 100644 --- a/core/repository-impl/src/main/kotlin/org/michaelbel/movies/repository/AccountRepositoryImpl.kt +++ b/core/repository-impl/src/main/kotlin/org/michaelbel/movies/repository/AccountRepositoryImpl.kt @@ -37,7 +37,7 @@ internal class AccountRepositoryImpl @Inject constructor( setAccountExpireTime(System.currentTimeMillis()) } accountDao.insert(account.mapToAccountDb) - } catch (e: Exception) { + } catch (ignored: Exception) { throw AccountDetailsException } } diff --git a/core/repository-impl/src/main/kotlin/org/michaelbel/movies/repository/AuthenticationRepositoryImpl.kt b/core/repository-impl/src/main/kotlin/org/michaelbel/movies/repository/AuthenticationRepositoryImpl.kt index c0d162f89..bdc89411a 100644 --- a/core/repository-impl/src/main/kotlin/org/michaelbel/movies/repository/AuthenticationRepositoryImpl.kt +++ b/core/repository-impl/src/main/kotlin/org/michaelbel/movies/repository/AuthenticationRepositoryImpl.kt @@ -31,7 +31,7 @@ internal class AuthenticationRepositoryImpl @Inject constructor( throw CreateRequestTokenException } token - } catch (e: Exception) { + } catch (ignored: Exception) { throw CreateRequestTokenException } } @@ -54,7 +54,7 @@ internal class AuthenticationRepositoryImpl @Inject constructor( throw CreateSessionWithLoginException } token - } catch (e: Exception) { + } catch (ignored: Exception) { throw CreateSessionWithLoginException } } @@ -71,7 +71,7 @@ internal class AuthenticationRepositoryImpl @Inject constructor( throw CreateSessionException } session - } catch (e: Exception) { + } catch (ignored: Exception) { throw CreateSessionException } } @@ -94,7 +94,7 @@ internal class AuthenticationRepositoryImpl @Inject constructor( } else { throw DeleteSessionException } - } catch (e: Exception) { + } catch (ignored: Exception) { throw DeleteSessionException } } diff --git a/core/repository/build.gradle.kts b/core/repository/build.gradle.kts index 89cea4a21..e874ffcfe 100644 --- a/core/repository/build.gradle.kts +++ b/core/repository/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/core/ui/build.gradle.kts b/core/ui/build.gradle.kts index 59ca29f26..8076d4719 100644 --- a/core/ui/build.gradle.kts +++ b/core/ui/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) } android { diff --git a/feature/account-impl/build.gradle.kts b/feature/account-impl/build.gradle.kts index 4bfa18f45..789ac7e66 100644 --- a/feature/account-impl/build.gradle.kts +++ b/feature/account-impl/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/feature/account/build.gradle.kts b/feature/account/build.gradle.kts index 87497dd6a..9aed5f2b0 100644 --- a/feature/account/build.gradle.kts +++ b/feature/account/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) } android { diff --git a/feature/auth-impl/build.gradle.kts b/feature/auth-impl/build.gradle.kts index 536c7cc4a..9cfa27b61 100644 --- a/feature/auth-impl/build.gradle.kts +++ b/feature/auth-impl/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/feature/auth/build.gradle.kts b/feature/auth/build.gradle.kts index f4ce1a863..9efd6ed6b 100644 --- a/feature/auth/build.gradle.kts +++ b/feature/auth/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) } android { diff --git a/feature/details-impl/build.gradle.kts b/feature/details-impl/build.gradle.kts index 6c4ceea16..db9f37e77 100644 --- a/feature/details-impl/build.gradle.kts +++ b/feature/details-impl/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/feature/details/build.gradle.kts b/feature/details/build.gradle.kts index e7e56781b..b17a1b2f4 100644 --- a/feature/details/build.gradle.kts +++ b/feature/details/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) } android { diff --git a/feature/feed-impl/build.gradle.kts b/feature/feed-impl/build.gradle.kts index 1cfa72ca2..1c8a87180 100644 --- a/feature/feed-impl/build.gradle.kts +++ b/feature/feed-impl/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/feature/feed/build.gradle.kts b/feature/feed/build.gradle.kts index 03fd62d3e..bb26112af 100644 --- a/feature/feed/build.gradle.kts +++ b/feature/feed/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) } android { diff --git a/feature/settings-impl/build.gradle.kts b/feature/settings-impl/build.gradle.kts index e13283ae7..061a7c399 100644 --- a/feature/settings-impl/build.gradle.kts +++ b/feature/settings-impl/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) id("movies-android-hilt") } diff --git a/feature/settings/build.gradle.kts b/feature/settings/build.gradle.kts index c11ef7cbf..1f2a4bac4 100644 --- a/feature/settings/build.gradle.kts +++ b/feature/settings/build.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.library) alias(libs.plugins.kotlin) + alias(libs.plugins.detekt) } android {