diff --git a/browser-switch/src/main/java/com/braintreepayments/api/AuthTabInternalClient.kt b/browser-switch/src/main/java/com/braintreepayments/api/AuthTabInternalClient.kt index 012e79e6..b2b511be 100644 --- a/browser-switch/src/main/java/com/braintreepayments/api/AuthTabInternalClient.kt +++ b/browser-switch/src/main/java/com/braintreepayments/api/AuthTabInternalClient.kt @@ -9,7 +9,7 @@ import androidx.browser.auth.AuthTabIntent import androidx.browser.customtabs.CustomTabsClient import androidx.browser.customtabs.CustomTabsIntent -internal class AuthTabInternalClient ( +internal class AuthTabInternalClient( private val authTabIntentBuilder: AuthTabIntent.Builder = AuthTabIntent.Builder(), private val customTabsIntentBuilder: CustomTabsIntent.Builder = CustomTabsIntent.Builder() ) { @@ -30,7 +30,7 @@ internal class AuthTabInternalClient ( context: Context, url: Uri, returnUrlScheme: String?, - appLinkUri: Uri?, + @Suppress("UnusedParameter") appLinkUri: Uri?, successAppLinkUri: Uri?, launcher: ActivityResultLauncher?, launchType: LaunchType?, @@ -68,4 +68,4 @@ internal class AuthTabInternalClient ( } customTabsIntent.launchUrl(context, url) } -} \ No newline at end of file +} diff --git a/browser-switch/src/main/java/com/braintreepayments/api/BrowserSwitchFinalResult.kt b/browser-switch/src/main/java/com/braintreepayments/api/BrowserSwitchFinalResult.kt index b8b78438..e3de547e 100644 --- a/browser-switch/src/main/java/com/braintreepayments/api/BrowserSwitchFinalResult.kt +++ b/browser-switch/src/main/java/com/braintreepayments/api/BrowserSwitchFinalResult.kt @@ -6,6 +6,7 @@ import org.json.JSONObject /** * The result of a browser switch obtained from [BrowserSwitchClient.completeRequest] */ +@Suppress("LibraryEntitiesShouldNotBePublic") sealed class BrowserSwitchFinalResult { /** diff --git a/browser-switch/src/main/java/com/braintreepayments/api/BrowserSwitchStartResult.kt b/browser-switch/src/main/java/com/braintreepayments/api/BrowserSwitchStartResult.kt index 7052b5e4..3ffa7246 100644 --- a/browser-switch/src/main/java/com/braintreepayments/api/BrowserSwitchStartResult.kt +++ b/browser-switch/src/main/java/com/braintreepayments/api/BrowserSwitchStartResult.kt @@ -3,6 +3,7 @@ package com.braintreepayments.api /** * The result of a browser switch obtained from [BrowserSwitchClient.start] */ +@Suppress("LibraryEntitiesShouldNotBePublic") sealed class BrowserSwitchStartResult { /** diff --git a/browser-switch/src/main/java/com/braintreepayments/api/LaunchType.kt b/browser-switch/src/main/java/com/braintreepayments/api/LaunchType.kt index 60d5cba1..38d580df 100644 --- a/browser-switch/src/main/java/com/braintreepayments/api/LaunchType.kt +++ b/browser-switch/src/main/java/com/braintreepayments/api/LaunchType.kt @@ -6,7 +6,8 @@ package com.braintreepayments.api * - [ACTIVITY_NEW_TASK]: sets the `Intent.FLAG_ACTIVITY_NEW_TASK` flag. * - [ACTIVITY_CLEAR_TOP]: sets the `Intent.FLAG_ACTIVITY_CLEAR_TOP` flag. */ +@Suppress("LibraryEntitiesShouldNotBePublic") enum class LaunchType { ACTIVITY_NEW_TASK, ACTIVITY_CLEAR_TOP -} \ No newline at end of file +} diff --git a/browser-switch/src/test/java/com/braintreepayments/api/AuthTabInternalClientUnitTest.kt b/browser-switch/src/test/java/com/braintreepayments/api/AuthTabInternalClientUnitTest.kt index 81529046..10d6ed2c 100644 --- a/browser-switch/src/test/java/com/braintreepayments/api/AuthTabInternalClientUnitTest.kt +++ b/browser-switch/src/test/java/com/braintreepayments/api/AuthTabInternalClientUnitTest.kt @@ -7,14 +7,21 @@ import androidx.activity.result.ActivityResultLauncher import androidx.browser.auth.AuthTabIntent import androidx.browser.customtabs.CustomTabsClient import androidx.browser.customtabs.CustomTabsIntent -import io.mockk.* -import org.junit.Assert.* +import io.mockk.clearAllMocks +import io.mockk.every +import io.mockk.mockk +import io.mockk.mockkStatic +import io.mockk.verify +import org.junit.Assert.assertEquals +import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue import org.junit.Before import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner @RunWith(RobolectricTestRunner::class) +@Suppress("LibraryEntitiesShouldNotBePublic") class AuthTabInternalClientUnitTest { private lateinit var authTabBuilder: AuthTabIntent.Builder diff --git a/browser-switch/src/test/java/com/braintreepayments/api/BrowserSwitchRequestUnitTest.kt b/browser-switch/src/test/java/com/braintreepayments/api/BrowserSwitchRequestUnitTest.kt index aa7577ad..4c1907ca 100644 --- a/browser-switch/src/test/java/com/braintreepayments/api/BrowserSwitchRequestUnitTest.kt +++ b/browser-switch/src/test/java/com/braintreepayments/api/BrowserSwitchRequestUnitTest.kt @@ -28,4 +28,4 @@ class BrowserSwitchRequestUnitTest { assertEquals("return-url-scheme", sut.returnUrlScheme) assertEquals(Uri.parse("https://app-link-uri.com"), sut.appLinkUri) } -} \ No newline at end of file +} diff --git a/build.gradle b/build.gradle index 36d8c39e..372388e5 100644 --- a/build.gradle +++ b/build.gradle @@ -31,6 +31,7 @@ buildscript { classpath 'com.android.tools.build:gradle:8.9.1' classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.9.10' classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0' + classpath 'io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.6' } } @@ -38,6 +39,7 @@ plugins { id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' id 'org.jetbrains.dokka' version '1.9.10' id 'org.jetbrains.kotlin.android' version '1.8.10' apply false + id 'io.gitlab.arturbosch.detekt' version '1.23.6' } version = '3.4.1-SNAPSHOT' @@ -79,6 +81,40 @@ dokkaHtmlMultiModule.configure { outputDirectory.set(project.file("docs")) } +dependencies { + detektPlugins 'io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6' + detektPlugins 'io.gitlab.arturbosch.detekt:detekt-rules-libraries:1.23.6' +} + +detekt { + toolVersion = "1.23.6" + config = files("detekt/detekt-config.yml") + input = files( + "browser-switch/src", + "demo/src" + ) + autoCorrect = project.hasProperty('detektAutoCorrect') + reports { + html { + enabled = true + destination = file("build/reports/detekt_report.html") + } + } +} + +subprojects { + apply plugin: 'io.gitlab.arturbosch.detekt' + + detekt { + config = files("$rootDir/detekt/detekt-config.yml") + } + + dependencies { + detektPlugins 'io.gitlab.arturbosch.detekt:detekt-formatting:1.23.6' + detektPlugins 'io.gitlab.arturbosch.detekt:detekt-rules-libraries:1.23.6' + } +} + task changeGradleReleaseVersion { doLast { def gradleFile = new File('build.gradle') diff --git a/ci b/ci index b4f364f6..6e97ab6e 100755 --- a/ci +++ b/ci @@ -15,6 +15,7 @@ case $command_name in ;; lint) ./gradlew clean lint + ./gradlew detekt --auto-correct ;; unit_tests) ./gradlew --stacktrace testRelease @@ -85,6 +86,7 @@ case $command_name in ;; android_lint) ./gradlew lint + ./gradlew detekt ;; esac diff --git a/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/ComposeActivity.kt b/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/ComposeActivity.kt index 571d7388..e1351488 100644 --- a/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/ComposeActivity.kt +++ b/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/ComposeActivity.kt @@ -2,6 +2,7 @@ package com.braintreepayments.api.browserswitch.demo import android.net.Uri import android.os.Bundle +import android.util.Log import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.viewModels @@ -39,6 +40,7 @@ class ComposeActivity : ComponentActivity() { try { browserSwitchClient.restorePendingRequest(pendingRequest) } catch (e: BrowserSwitchException) { + Log.e("ComposeActivity", "Failed to restore pending request", e) PendingRequestStore.clear(this) } } @@ -115,7 +117,6 @@ fun BrowserSwitchResult(viewModel: BrowserSwitchViewModel) { BrowserSwitchSuccess(result = it) } uiState.browserSwitchError?.let { BrowserSwitchError(exception = it) } - } @Composable @@ -158,4 +159,4 @@ fun BrowserSwitchError(exception: Exception) { ) exception.message?.let { Text(text = it, color = Color.White) } } -} \ No newline at end of file +} diff --git a/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/utils/PendingRequestStore.kt b/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/utils/PendingRequestStore.kt index 37791e6c..2b53637e 100644 --- a/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/utils/PendingRequestStore.kt +++ b/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/utils/PendingRequestStore.kt @@ -3,6 +3,7 @@ package com.braintreepayments.api.browserswitch.demo.utils import android.content.Context import android.content.SharedPreferences +@Suppress("UtilityClassWithPublicConstructor") class PendingRequestStore { companion object { @@ -37,4 +38,4 @@ class PendingRequestStore { sharedPreferences.edit().remove(PENDING_REQUEST_KEY).apply() } } -} \ No newline at end of file +} diff --git a/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/viewmodel/BrowserSwitchViewModel.kt b/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/viewmodel/BrowserSwitchViewModel.kt index 3e280e9d..984eed79 100644 --- a/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/viewmodel/BrowserSwitchViewModel.kt +++ b/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/viewmodel/BrowserSwitchViewModel.kt @@ -26,4 +26,4 @@ class BrowserSwitchViewModel : ViewModel() { _uiState.update { it.copy(browserSwitchError = value) } _uiState.update { it.copy(browserSwitchFinalResult = null) } } -} \ No newline at end of file +} diff --git a/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/viewmodel/UiState.kt b/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/viewmodel/UiState.kt index 3f02cffd..714052f9 100644 --- a/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/viewmodel/UiState.kt +++ b/demo/src/main/java/com/braintreepayments/api/browserswitch/demo/viewmodel/UiState.kt @@ -2,7 +2,7 @@ package com.braintreepayments.api.browserswitch.demo.viewmodel import com.braintreepayments.api.BrowserSwitchFinalResult -data class UiState ( +data class UiState( val browserSwitchFinalResult: BrowserSwitchFinalResult? = null, val browserSwitchError: Exception? = null, -) \ No newline at end of file +) diff --git a/detekt/detekt-config.yml b/detekt/detekt-config.yml new file mode 100644 index 00000000..a9e79dda --- /dev/null +++ b/detekt/detekt-config.yml @@ -0,0 +1,769 @@ +build: + maxIssues: 0 + excludeCorrectable: false + weights: + # complexity: 2 + # LongParameterList: 1 + # style: 1 + # comments: 1 + +config: + validation: true + warningsAsErrors: true + # when writing own rules with new properties, exclude the property path e.g.: 'my_rule_set,.*>.*>[my_property]' + excludes: '' + +processors: + active: true + exclude: + - 'DetektProgressListener' + # - 'KtFileCountProcessor' + # - 'PackageCountProcessor' + # - 'ClassCountProcessor' + # - 'FunctionCountProcessor' + # - 'PropertyCountProcessor' + # - 'ProjectComplexityProcessor' + # - 'ProjectCognitiveComplexityProcessor' + # - 'ProjectLLOCProcessor' + # - 'ProjectCLOCProcessor' + # - 'ProjectLOCProcessor' + # - 'ProjectSLOCProcessor' + # - 'LicenseHeaderLoaderExtension' + +console-reports: + active: true + exclude: + - 'ProjectStatisticsReport' + - 'ComplexityReport' + - 'NotificationReport' + # - 'FindingsReport' + - 'FileBasedFindingsReport' + +output-reports: + active: true + exclude: + # - 'TxtOutputReport' + # - 'XmlOutputReport' + # - 'HtmlOutputReport' + +comments: + active: true + AbsentOrWrongFileLicense: + active: false + licenseTemplateFile: 'license.template' + licenseTemplateIsRegex: false + CommentOverPrivateFunction: + active: false + CommentOverPrivateProperty: + active: false + DeprecatedBlockTag: + active: false + EndOfSentenceFormat: + active: false + endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)' + UndocumentedPublicClass: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + searchInNestedClass: true + searchInInnerClass: true + searchInInnerObject: true + searchInInnerInterface: true + UndocumentedPublicFunction: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + UndocumentedPublicProperty: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + +complexity: + active: true + ComplexCondition: + active: true + threshold: 4 + ComplexInterface: + active: false + threshold: 10 + includeStaticDeclarations: false + includePrivateDeclarations: false + CyclomaticComplexMethod: + active: true + threshold: 15 + ignoreSingleWhenExpression: false + ignoreSimpleWhenEntries: false + ignoreNestingFunctions: false + nestingFunctions: + - 'run' + - 'let' + - 'apply' + - 'with' + - 'also' + - 'use' + - 'forEach' + - 'isNotNull' + - 'ifNull' + LabeledExpression: + active: false + ignoredLabels: [] + LargeClass: + active: true + threshold: 600 + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/TLSCertificatePinning.kt'] + LongMethod: + active: true + threshold: 60 + ignoreAnnotated: [Composable] + LongParameterList: + active: true + functionThreshold: 10 + constructorThreshold: 10 + ignoreDefaultParameters: true + ignoreDataClasses: true + ignoreAnnotated: [] + MethodOverloading: + active: false + threshold: 6 + NamedArguments: + active: false + threshold: 3 + NestedBlockDepth: + active: true + threshold: 5 + ReplaceSafeCallChainWithRun: + active: false + StringLiteralDuplication: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + threshold: 3 + ignoreAnnotation: true + excludeStringsWithLessThan5Characters: true + ignoreStringsRegex: '$^' + TooManyFunctions: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + thresholdInFiles: 11 + thresholdInClasses: 11 + thresholdInInterfaces: 11 + thresholdInObjects: 11 + thresholdInEnums: 11 + ignoreDeprecated: false + ignorePrivate: false + ignoreOverridden: false + +coroutines: + active: true + GlobalCoroutineUsage: + active: false + RedundantSuspendModifier: + active: false + SleepInsteadOfDelay: + active: false + SuspendFunWithFlowReturnType: + active: false + +empty-blocks: + active: true + EmptyCatchBlock: + active: true + allowedExceptionNameRegex: '_|(ignore|expected).*' + EmptyClassBlock: + active: true + EmptyDefaultConstructor: + active: true + EmptyDoWhileBlock: + active: true + EmptyElseBlock: + active: true + EmptyFinallyBlock: + active: true + EmptyForBlock: + active: true + EmptyFunctionBlock: + active: true + ignoreOverridden: false + EmptyIfBlock: + active: true + EmptyInitBlock: + active: true + EmptyKtFile: + active: true + EmptySecondaryConstructor: + active: true + EmptyTryBlock: + active: true + EmptyWhenBlock: + active: true + EmptyWhileBlock: + active: true + +exceptions: + active: true + ExceptionRaisedInUnexpectedLocation: + active: true + methodNames: + - 'toString' + - 'hashCode' + - 'equals' + - 'finalize' + InstanceOfCheckForException: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + NotImplementedDeclaration: + active: false + ObjectExtendsThrowable: + active: false + PrintStackTrace: + active: true + RethrowCaughtException: + active: true + ReturnFromFinally: + active: true + ignoreLabeled: false + SwallowedException: + active: true + ignoredExceptionTypes: + - 'NumberFormatException' + - 'InterruptedException' + - 'ParseException' + - 'MalformedURLException' + - 'JSONException' + allowedExceptionNameRegex: '_|(ignore|expected).*' + ThrowingExceptionFromFinally: + active: true + ThrowingExceptionInMain: + active: false + ThrowingExceptionsWithoutMessageOrCause: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + exceptions: + - 'ArrayIndexOutOfBoundsException' + - 'Error' + - 'Exception' + - 'IllegalMonitorStateException' + - 'NullPointerException' + - 'IndexOutOfBoundsException' + - 'RuntimeException' + - 'Throwable' + ThrowingNewInstanceOfSameException: + active: true + TooGenericExceptionCaught: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + exceptionNames: + - 'ArrayIndexOutOfBoundsException' + - 'Error' + - 'Exception' + - 'IllegalMonitorStateException' + - 'NullPointerException' + - 'IndexOutOfBoundsException' + - 'RuntimeException' + - 'Throwable' + allowedExceptionNameRegex: '_|(ignore|expected).*' + TooGenericExceptionThrown: + active: true + exceptionNames: + - 'Error' + - 'Exception' + - 'Throwable' + - 'RuntimeException' + +formatting: + active: true + android: false + autoCorrect: true + AnnotationOnSeparateLine: + active: false + autoCorrect: true + AnnotationSpacing: + active: false + autoCorrect: true + ArgumentListWrapping: + active: false + autoCorrect: true + indentSize: 4 + maxLineLength: 120 + ChainWrapping: + active: true + autoCorrect: true + CommentSpacing: + active: true + autoCorrect: true + EnumEntryNameCase: + active: false + autoCorrect: true + Filename: + active: true + FinalNewline: + active: true + autoCorrect: true + insertFinalNewLine: true + ImportOrdering: + active: false + autoCorrect: true + layout: '*,java.**,javax.**,kotlin.**,^' + Indentation: + active: false + autoCorrect: true + indentSize: 4 + MaximumLineLength: + active: true + maxLineLength: 120 + ignoreBackTickedIdentifier: true + ModifierOrdering: + active: true + autoCorrect: true + MultiLineIfElse: + active: true + autoCorrect: true + NoBlankLineBeforeRbrace: + active: true + autoCorrect: true + NoConsecutiveBlankLines: + active: true + autoCorrect: true + NoEmptyClassBody: + active: true + autoCorrect: true + NoEmptyFirstLineInMethodBlock: + active: false + autoCorrect: true + NoLineBreakAfterElse: + active: true + autoCorrect: true + NoLineBreakBeforeAssignment: + active: true + autoCorrect: true + NoMultipleSpaces: + active: true + autoCorrect: true + NoSemicolons: + active: true + autoCorrect: true + NoTrailingSpaces: + active: true + autoCorrect: true + NoUnitReturn: + active: true + autoCorrect: true + NoUnusedImports: + active: true + autoCorrect: true + NoWildcardImports: + active: false + PackageName: + active: true + autoCorrect: true + SpacingAroundAngleBrackets: + active: false + autoCorrect: true + SpacingAroundColon: + active: true + autoCorrect: true + SpacingAroundComma: + active: true + autoCorrect: true + SpacingAroundCurly: + active: true + autoCorrect: true + SpacingAroundDot: + active: true + autoCorrect: true + SpacingAroundDoubleColon: + active: false + autoCorrect: true + SpacingAroundKeyword: + active: true + autoCorrect: true + SpacingAroundOperators: + active: true + autoCorrect: true + SpacingAroundParens: + active: true + autoCorrect: true + SpacingAroundRangeOperator: + active: true + autoCorrect: true + SpacingAroundUnaryOperator: + active: false + autoCorrect: true + SpacingBetweenDeclarationsWithAnnotations: + active: false + autoCorrect: true + SpacingBetweenDeclarationsWithComments: + active: false + autoCorrect: true + StringTemplate: + active: true + autoCorrect: true + +naming: + active: true + ClassNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + classPattern: '[A-Z][a-zA-Z0-9]*' + ConstructorParameterNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + parameterPattern: '[a-z][A-Za-z0-9]*' + privateParameterPattern: '[a-z][A-Za-z0-9]*' + excludeClassPattern: '$^' + EnumNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + enumEntryPattern: '[A-Z][_a-zA-Z0-9]*' + ForbiddenClassName: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + forbiddenName: [] + FunctionMaxLength: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + maximumFunctionNameLength: 30 + FunctionMinLength: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + minimumFunctionNameLength: 3 + FunctionNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + functionPattern: '([a-z][a-zA-Z0-9]*)|(`.*`)' + excludeClassPattern: '$^' + ignoreAnnotated: + - 'Composable' + FunctionParameterNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + parameterPattern: '[a-z][A-Za-z0-9]*' + excludeClassPattern: '$^' + InvalidPackageDeclaration: + active: false + excludes: ['**/*.kts'] + rootPackage: '' + MatchingDeclarationName: + active: true + mustBeFirst: true + MemberNameEqualsClassName: + active: true + ignoreOverridden: true + NoNameShadowing: + active: false + NonBooleanPropertyPrefixedWithIs: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + ObjectPropertyNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + constantPattern: '[A-Za-z][_A-Za-z0-9]*' + propertyPattern: '[A-Za-z][_A-Za-z0-9]*' + privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*' + PackageNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*' + TopLevelPropertyNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + constantPattern: '[A-Z][_A-Z0-9]*' + propertyPattern: '[A-Za-z][_A-Za-z0-9]*' + privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*' + VariableMaxLength: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + maximumVariableNameLength: 64 + VariableMinLength: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + minimumVariableNameLength: 1 + VariableNaming: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + variablePattern: '[a-z][A-Za-z0-9]*' + privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' + excludeClassPattern: '$^' + +performance: + active: true + ArrayPrimitive: + active: true + ForEachOnRange: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + SpreadOperator: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + UnnecessaryTemporaryInstantiation: + active: true + +potential-bugs: + active: true + # AvoidReferentialEquality: + # active: false + # forbiddenTypePatterns: + # - 'kotlin.String' + CastToNullableType: + active: false + Deprecation: + active: false + DontDowncastCollectionTypes: + active: false + DoubleMutabilityForCollection: + active: false + EqualsAlwaysReturnsTrueOrFalse: + active: true + EqualsWithHashCodeExist: + active: true + ExitOutsideMain: + active: false + ExplicitGarbageCollectionCall: + active: true + HasPlatformType: + active: false + IgnoredReturnValue: + active: false + restrictToConfig: true + returnValueAnnotations: + - '*.CheckReturnValue' + - '*.CheckResult' + # ignoreReturnValueAnnotations: + # - '*.CanIgnoreReturnValue' + ImplicitDefaultLocale: + active: true + ImplicitUnitReturnType: + active: false + allowExplicitReturnType: true + InvalidRange: + active: true + IteratorHasNextCallsNextMethod: + active: true + IteratorNotThrowingNoSuchElementException: + active: true + LateinitUsage: + active: false + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + ignoreAnnotated: [] + ignoreOnClassesPattern: '' + MapGetWithNotNullAssertionOperator: + active: false + NullableToStringCall: + active: false + UnconditionalJumpStatementInLoop: + active: false + UnnecessaryNotNullOperator: + active: true + UnnecessarySafeCall: + active: true + UnreachableCatchBlock: + active: false + UnreachableCode: + active: true + UnsafeCallOnNullableType: + active: true + UnsafeCast: + active: true + UnusedUnaryOperator: + active: false + UselessPostfixExpression: + active: false + WrongEqualsTypeParameter: + active: true + +libraries: + active: true + LibraryEntitiesShouldNotBePublic: + active: true + excludes: ['**/test/**', '**/androidTest/**','**/demo/**'] + +style: + active: true + ClassOrdering: + active: false + CollapsibleIfStatements: + active: false + DataClassContainsFunctions: + active: false + conversionFunctionPrefix: + - 'to' + DataClassShouldBeImmutable: + active: false + DestructuringDeclarationWithTooManyEntries: + active: false + maxDestructuringEntries: 3 + EqualsNullCall: + active: true + EqualsOnSignatureLine: + active: false + ExplicitCollectionElementAccessMethod: + active: false + ExplicitItLambdaParameter: + active: false + ExpressionBodySyntax: + active: false + includeLineWrapping: false + ForbiddenComment: + active: true + comments: + - 'FIXME:' + - 'STOPSHIP:' + allowedPatterns: '' + ForbiddenImport: + active: false + imports: [] + forbiddenPatterns: '' + ForbiddenMethodCall: + active: false + methods: + - 'kotlin.io.println' + - 'kotlin.io.print' + ForbiddenVoid: + active: false + ignoreOverridden: false + ignoreUsageInGenerics: false + FunctionOnlyReturningConstant: + active: true + ignoreOverridableFunction: true + ignoreActualFunction: true + excludedFunctions: + - '' + ignoreAnnotated: + - 'dagger.Provides' + LoopWithTooManyJumpStatements: + active: true + maxJumpCount: 1 + MagicNumber: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + ignoreNumbers: + - '-1' + - '0' + - '1' + - '2' + ignoreHashCodeFunction: true + ignorePropertyDeclaration: false + ignoreLocalVariableDeclaration: false + ignoreConstantDeclaration: true + ignoreCompanionObjectPropertyDeclaration: true + ignoreAnnotation: false + ignoreNamedArgument: true + ignoreEnums: false + ignoreRanges: false + ignoreExtensionFunctions: true + MandatoryBracesLoops: + active: false + MaxLineLength: + active: true + maxLineLength: 120 + excludePackageStatements: true + excludeImportStatements: true + excludeCommentStatements: false + MayBeConst: + active: true + ModifierOrder: + active: true + MultilineLambdaItParameter: + active: false + NestedClassesVisibility: + active: true + NewLineAtEndOfFile: + active: true + NoTabs: + active: false + ObjectLiteralToLambda: + active: false + OptionalAbstractKeyword: + active: true + OptionalUnit: + active: false + PreferToOverPairSyntax: + active: false + ProtectedMemberInFinalClass: + active: true + RedundantExplicitType: + active: false + RedundantHigherOrderMapUsage: + active: false + RedundantVisibilityModifierRule: + active: false + ReturnCount: + active: true + max: 4 + excludedFunctions: + - 'equals' + excludeLabeled: false + excludeReturnFromLambda: true + excludeGuardClauses: false + SafeCast: + active: true + SerialVersionUIDInSerializableClass: + active: true + SpacingBetweenPackageAndImports: + active: false + ThrowsCount: + active: true + max: 2 + excludeGuardClauses: false + TrailingWhitespace: + active: false + UnderscoresInNumericLiterals: + active: false + acceptableLength: 5 + UnnecessaryAbstractClass: + active: true + ignoreAnnotated: + - 'dagger.Module' + UnnecessaryAnnotationUseSiteTarget: + active: false + UnnecessaryApply: + active: true + UnnecessaryFilter: + active: false + UnnecessaryInheritance: + active: true + UnnecessaryLet: + active: false + UnnecessaryParentheses: + active: false + UntilInsteadOfRangeTo: + active: false + UnusedImports: + active: false + UnusedPrivateClass: + active: true + UnusedPrivateMember: + active: true + allowedNames: '(_|ignored|expected|serialVersionUID)' + UseArrayLiteralsInAnnotations: + active: false + UseCheckNotNull: + active: false + UseCheckOrError: + active: false + UseDataClass: + active: false + ignoreAnnotated: [] + allowVars: false + UseEmptyCounterpart: + active: false + UseIfEmptyOrIfBlank: + active: false + UseIfInsteadOfWhen: + active: false + UseIsNullOrEmpty: + active: false + UseOrEmpty: + active: false + UseRequire: + active: false + UseRequireNotNull: + active: false + UselessCallOnNotNull: + active: true + UtilityClassWithPublicConstructor: + active: true + VarCouldBeVal: + active: true + WildcardImport: + active: true + excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludeImports: + - 'java.util.*' + - 'kotlinx.android.synthetic.*' \ No newline at end of file