diff options
-rw-r--r-- | .github/workflows/pull_request.yml | 6 | ||||
-rw-r--r-- | build-logic/build.gradle.kts | 1 | ||||
-rw-r--r-- | build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt | 19 | ||||
-rw-r--r-- | config/detekt/detekt.yml | 699 | ||||
-rw-r--r-- | detekt-baselines/app.xml | 102 | ||||
-rw-r--r-- | detekt-baselines/autofill-parser.xml | 29 | ||||
-rw-r--r-- | detekt-baselines/coroutine-utils.xml | 9 | ||||
-rw-r--r-- | detekt-baselines/crypto-pgpainless.xml | 7 | ||||
-rw-r--r-- | detekt-baselines/format-common.xml | 8 | ||||
-rw-r--r-- | detekt-baselines/random.xml | 19 | ||||
-rw-r--r-- | detekt-baselines/sentry-stub.xml | 11 | ||||
-rw-r--r-- | detekt-baselines/ssh.xml | 9 | ||||
-rw-r--r-- | detekt-baselines/ui-compose.xml | 5 | ||||
-rw-r--r-- | gradle/libs.versions.toml | 1 | ||||
-rw-r--r-- | scripts/pre-push-hook.sh | 2 |
15 files changed, 4 insertions, 923 deletions
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 9602ee16..8978f14c 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -194,7 +194,7 @@ jobs: name: Build report path: build/reports/kotlin-build/ - detekt: + lint: needs: [ "check-changed-files" ] runs-on: ubuntu-latest steps: @@ -212,10 +212,10 @@ jobs: - name: Copy CI gradle.properties run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties - - name: Run detekt + - name: Run Lint uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 # v2.4.2 with: - arguments: detekt + arguments: lint gradle-home-cache-cleanup: true - name: Upload Kotlin build report diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index 41ee7256..5d7ab383 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -91,7 +91,6 @@ gradlePlugin { dependencies { implementation(platform(libs.kotlin.bom)) implementation(libs.build.agp) - implementation(libs.build.detekt) implementation(libs.build.diffutils) implementation(libs.build.download) implementation(libs.build.kotlin) diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt index 6d43a494..54907b1c 100644 --- a/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/KotlinCommonPlugin.kt @@ -5,17 +5,13 @@ package app.passwordstore.gradle -import io.gitlab.arturbosch.detekt.DetektPlugin -import io.gitlab.arturbosch.detekt.extensions.DetektExtension import org.gradle.api.JavaVersion import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.tasks.compile.JavaCompile import org.gradle.api.tasks.testing.Test import org.gradle.api.tasks.testing.logging.TestLogEvent -import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.withType -import org.gradle.language.base.plugins.LifecycleBasePlugin import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.dsl.KotlinVersion import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -25,22 +21,7 @@ class KotlinCommonPlugin : Plugin<Project> { override fun apply(project: Project) { val isAppModule = project.pluginManager.hasPlugin("com.android.application") - project.pluginManager.apply(DetektPlugin::class.java) - project.extensions.configure<DetektExtension> { - parallel = true - ignoredBuildTypes = listOf("release") - ignoredFlavors = listOf("free") - basePath = project.layout.projectDirectory.toString() - baseline = - project.rootProject.layout.projectDirectory - .dir("detekt-baselines") - .file("${project.name}.xml") - .asFile - } project.tasks.run { - project.pluginManager.withPlugin("base") { - named(LifecycleBasePlugin.CHECK_TASK_NAME).configure { this.dependsOn(named("detekt")) } - } withType<JavaCompile>().configureEach { sourceCompatibility = JavaVersion.VERSION_11.toString() targetCompatibility = JavaVersion.VERSION_11.toString() diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml deleted file mode 100644 index 67d95a88..00000000 --- a/config/detekt/detekt.yml +++ /dev/null @@ -1,699 +0,0 @@ -build: - maxIssues: 0 - excludeCorrectable: false - weights: - # complexity: 2 - # LongParameterList: 1 - # style: 1 - # comments: 1 - -config: - validation: true - warningsAsErrors: false - # 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' - # - 'LiteFindingsReport' - -output-reports: - active: true - exclude: - # - 'TxtOutputReport' - # - 'XmlOutputReport' - # - 'HtmlOutputReport' - # - 'MdOutputReport' - -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<])|([.?!:]$)' - KDocReferencesNonPublicProperty: - active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - OutdatedDocumentation: - active: false - matchTypeParameters: true - matchDeclarationsOrder: true - allowParamOnConstructorProperties: false - 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 - CognitiveComplexMethod: - active: false - threshold: 15 - ComplexCondition: - active: true - threshold: 4 - ComplexInterface: - active: false - threshold: 10 - includeStaticDeclarations: false - includePrivateDeclarations: false - # TODO(msfjarvis): cleanup the offenders and wind this down - CyclomaticComplexMethod: - active: true - threshold: 40 - ignoreSingleWhenExpression: false - ignoreSimpleWhenEntries: false - ignoreNestingFunctions: false - nestingFunctions: - - 'also' - - 'apply' - - 'forEach' - - 'isNotNull' - - 'ifNull' - - 'let' - - 'run' - - 'use' - - 'with' - LabeledExpression: - active: false - ignoredLabels: [] - LargeClass: - active: true - threshold: 600 - LongMethod: - active: true - threshold: 60 - LongParameterList: - active: true - functionThreshold: 6 - constructorThreshold: 7 - ignoreDefaultParameters: false - ignoreDataClasses: true - ignoreAnnotatedParameter: [] - MethodOverloading: - active: false - threshold: 6 - NamedArguments: - active: false - threshold: 3 - ignoreArgumentsMatchingNames: false - NestedBlockDepth: - active: true - threshold: 4 - NestedScopeFunctions: - active: false - threshold: 1 - functions: - - 'kotlin.apply' - - 'kotlin.run' - - 'kotlin.with' - - 'kotlin.let' - - 'kotlin.also' - 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: 15 - thresholdInClasses: 15 - thresholdInInterfaces: 15 - thresholdInObjects: 15 - thresholdInEnums: 15 - ignoreDeprecated: false - ignorePrivate: false - ignoreOverridden: false - -coroutines: - active: true - GlobalCoroutineUsage: - active: false - InjectDispatcher: - active: true - dispatcherNames: - - 'IO' - - 'Default' - - 'Unconfined' - RedundantSuspendModifier: - active: true - SleepInsteadOfDelay: - active: true - SuspendFunWithCoroutineScopeReceiver: - active: false - SuspendFunWithFlowReturnType: - active: true - -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: - - 'equals' - - 'finalize' - - 'hashCode' - - 'toString' - InstanceOfCheckForException: - active: true - 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: - - 'InterruptedException' - - 'MalformedURLException' - - 'NumberFormatException' - - 'ParseException' - allowedExceptionNameRegex: '_|(ignore|expected).*' - ThrowingExceptionFromFinally: - active: true - ThrowingExceptionInMain: - active: false - ThrowingExceptionsWithoutMessageOrCause: - active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - exceptions: - - 'ArrayIndexOutOfBoundsException' - - 'Exception' - - 'IllegalArgumentException' - - 'IllegalMonitorStateException' - - 'IllegalStateException' - - 'IndexOutOfBoundsException' - - 'NullPointerException' - - 'RuntimeException' - - 'Throwable' - ThrowingNewInstanceOfSameException: - active: true - TooGenericExceptionCaught: - active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - exceptionNames: - - 'ArrayIndexOutOfBoundsException' - - 'Error' - - 'Exception' - - 'IllegalMonitorStateException' - - 'IndexOutOfBoundsException' - - 'NullPointerException' - - 'RuntimeException' - - 'Throwable' - allowedExceptionNameRegex: '_|(ignore|expected).*' - TooGenericExceptionThrown: - active: true - exceptionNames: - - 'Error' - - 'Exception' - - 'RuntimeException' - - 'Throwable' - -naming: - active: true - BooleanPropertyNaming: - active: false - allowedPattern: '^(is|has|are)' - ignoreOverridden: true - ClassNaming: - active: true - classPattern: '[A-Z][a-zA-Z0-9]*' - ConstructorParameterNaming: - active: true - 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]*' - ForbiddenClassName: - active: false - forbiddenName: [] - FunctionMaxLength: - active: false - maximumFunctionNameLength: 30 - FunctionMinLength: - active: false - minimumFunctionNameLength: 3 - FunctionNaming: - active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - functionPattern: '[a-z][a-zA-Z0-9]*' - excludeClassPattern: '$^' - ignoreOverridden: true - ignoreAnnotated: ['Composable'] - FunctionParameterNaming: - active: true - parameterPattern: '[a-z][A-Za-z0-9]*' - excludeClassPattern: '$^' - ignoreOverridden: true - InvalidPackageDeclaration: - active: true - rootPackage: '' - requireRootInDeclaration: false - LambdaParameterNaming: - active: false - parameterPattern: '[a-z][A-Za-z0-9]*|_' - MatchingDeclarationName: - active: true - mustBeFirst: true - MemberNameEqualsClassName: - active: true - ignoreOverridden: true - NoNameShadowing: - active: true - NonBooleanPropertyPrefixedWithIs: - active: false - ObjectPropertyNaming: - active: true - 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 - packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*' - TopLevelPropertyNaming: - active: true - constantPattern: '[A-Z][A-Za-z0-9]*' - propertyPattern: '[A-Za-z][_A-Za-z0-9]*' - privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*' - VariableMaxLength: - active: false - maximumVariableNameLength: 64 - VariableMinLength: - active: false - minimumVariableNameLength: 1 - VariableNaming: - active: true - variablePattern: '[a-z][A-Za-z0-9]*' - privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' - excludeClassPattern: '$^' - ignoreOverridden: true - -performance: - active: true - ArrayPrimitive: - active: true - CouldBeSequence: - active: false - threshold: 3 - 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: true - forbiddenTypePatterns: - - 'kotlin.String' - CastToNullableType: - active: false - Deprecation: - active: false - DontDowncastCollectionTypes: - active: false - DoubleMutabilityForCollection: - active: true - mutableTypes: - - 'kotlin.collections.MutableList' - - 'kotlin.collections.MutableMap' - - 'kotlin.collections.MutableSet' - - 'java.util.ArrayList' - - 'java.util.LinkedHashSet' - - 'java.util.HashSet' - - 'java.util.LinkedHashMap' - - 'java.util.HashMap' - ElseCaseInsteadOfExhaustiveWhen: - active: false - EqualsAlwaysReturnsTrueOrFalse: - active: true - EqualsWithHashCodeExist: - active: true - ExitOutsideMain: - active: false - ExplicitGarbageCollectionCall: - active: true - HasPlatformType: - active: true - IgnoredReturnValue: - active: true - restrictToConfig: true - returnValueAnnotations: - - '*.CheckResult' - - '*.CheckReturnValue' - ignoreReturnValueAnnotations: - - '*.CanIgnoreReturnValue' - ignoreFunctionCall: [] - 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/**'] - ignoreOnClassesPattern: '' - MapGetWithNotNullAssertionOperator: - active: true - MissingPackageDeclaration: - active: false - excludes: ['**/*.kts'] - NullCheckOnMutableProperty: - active: false - NullableToStringCall: - active: false - UnconditionalJumpStatementInLoop: - active: false - UnnecessaryNotNullOperator: - active: true - UnnecessarySafeCall: - active: true - UnreachableCatchBlock: - active: true - UnreachableCode: - active: true - UnsafeCallOnNullableType: - active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - UnsafeCast: - active: true - UnusedUnaryOperator: - active: true - UselessPostfixExpression: - active: true - WrongEqualsTypeParameter: - active: true - -style: - active: true - CanBeNonNullable: - active: false - CascadingCallWrapping: - active: false - includeElvis: true - ClassOrdering: - active: false - CollapsibleIfStatements: - active: false - DataClassContainsFunctions: - active: false - conversionFunctionPrefix: ['to'] - DataClassShouldBeImmutable: - active: false - DestructuringDeclarationWithTooManyEntries: - active: true - maxDestructuringEntries: 3 - EqualsNullCall: - active: true - EqualsOnSignatureLine: - active: false - ExplicitCollectionElementAccessMethod: - active: false - ExplicitItLambdaParameter: - active: true - ExpressionBodySyntax: - active: false - includeLineWrapping: false - ForbiddenComment: - active: true - values: - - 'FIXME:' - - 'STOPSHIP:' - - 'TODO:' - allowedPatterns: '' - customMessage: '' - ForbiddenImport: - active: false - imports: [] - forbiddenPatterns: '' - ForbiddenMethodCall: - active: false - methods: - - 'kotlin.io.print' - - 'kotlin.io.println' - ForbiddenSuppress: - active: false - rules: [] - ForbiddenVoid: - active: true - ignoreOverridden: false - ignoreUsageInGenerics: false - FunctionOnlyReturningConstant: - active: true - ignoreOverridableFunction: true - ignoreActualFunction: true - excludedFunctions: [] - LoopWithTooManyJumpStatements: - active: true - maxJumpCount: 1 - MagicNumber: - active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**', '**/*.kts'] - ignoreNumbers: - - '-1' - - '0' - - '1' - - '2' - ignoreHashCodeFunction: true - ignorePropertyDeclaration: true - ignoreLocalVariableDeclaration: false - ignoreConstantDeclaration: true - ignoreCompanionObjectPropertyDeclaration: true - ignoreAnnotation: false - ignoreNamedArgument: true - ignoreEnums: false - ignoreRanges: false - ignoreExtensionFunctions: true - MandatoryBracesIfStatements: - active: false - MandatoryBracesLoops: - active: false - MaxChainedCallsOnSameLine: - active: false - maxChainedCalls: 5 - 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 - NullableBooleanCheck: - active: false - ObjectLiteralToLambda: - active: true - OptionalAbstractKeyword: - active: true - OptionalUnit: - active: false - OptionalWhenBraces: - active: false - PreferToOverPairSyntax: - active: false - ProtectedMemberInFinalClass: - active: true - RedundantExplicitType: - active: false - RedundantHigherOrderMapUsage: - active: true - RedundantVisibilityModifierRule: - active: false - ReturnCount: - active: true - max: 2 - 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: 4 - allowNonStandardGrouping: false - UnnecessaryAbstractClass: - active: true - UnnecessaryAnnotationUseSiteTarget: - active: false - UnnecessaryApply: - active: true - UnnecessaryBackticks: - active: false - UnnecessaryFilter: - active: true - UnnecessaryInheritance: - active: true - UnnecessaryInnerClass: - active: false - UnnecessaryLet: - active: false - UnnecessaryParentheses: - active: false - UntilInsteadOfRangeTo: - active: false - UnusedImports: - active: false - UnusedPrivateClass: - active: true - UnusedPrivateMember: - active: true - allowedNames: '(_|ignored|expected|serialVersionUID)' - ignoreAnnotated: ['Preview'] - UseAnyOrNoneInsteadOfFind: - active: true - UseArrayLiteralsInAnnotations: - active: true - UseCheckNotNull: - active: true - UseCheckOrError: - active: true - UseDataClass: - active: false - allowVars: false - UseEmptyCounterpart: - active: false - UseIfEmptyOrIfBlank: - active: false - UseIfInsteadOfWhen: - active: false - UseIsNullOrEmpty: - active: true - UseOrEmpty: - active: true - UseRequire: - active: true - UseRequireNotNull: - active: true - UselessCallOnNotNull: - active: true - UtilityClassWithPublicConstructor: - active: true - VarCouldBeVal: - active: true - ignoreLateinitVar: false - WildcardImport: - active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - excludeImports: - - 'java.util.*' diff --git a/detekt-baselines/app.xml b/detekt-baselines/app.xml deleted file mode 100644 index bf021902..00000000 --- a/detekt-baselines/app.xml +++ /dev/null @@ -1,102 +0,0 @@ -<?xml version="1.0" ?> -<SmellBaseline> - <ManuallySuppressedIssues></ManuallySuppressedIssues> - <CurrentIssues> - <ID>ComplexCondition:AutofillFilterView.kt$AutofillFilterView$(list.isEmpty() && rvPasswordSwitcher.nextView.id == rvPasswordEmpty.id) || (list.isNotEmpty() && rvPasswordSwitcher.nextView.id == rvPassword.id)</ID> - <ID>ComplexCondition:BaseGitActivity.kt$BaseGitActivity$(rootCause is org.eclipse.jgit.errors.TransportException || rootCause is org.eclipse.jgit.api.errors.TransportException || rootCause is org.eclipse.jgit.api.errors.InvalidRemoteException || (rootCause is UserAuthException && rootCause.message == "Exhausted available authentication methods"))</ID> - <ID>ComplexCondition:GitServerConfigActivity.kt$GitServerConfigActivity$localDir.exists() && localDirFiles.isNotEmpty() && !(localDirFiles.size == 1 && localDirFiles[0].name == ".git")</ID> - <ID>ComplexCondition:PasswordCreationActivity.kt$PasswordCreationActivity$(!editing || (editing && suggestedName != file.nameWithoutExtension)) && file.exists()</ID> - <ID>ComplexCondition:PasswordStore.kt$PasswordStore$(keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_F && event.isCtrlPressed) && !searchItem.isActionViewExpanded</ID> - <ID>EmptyFunctionBlock:BasicBottomSheet.kt$BasicBottomSheet.<no name provided>${}</ID> - <ID>EmptyFunctionBlock:ItemCreationBottomSheet.kt$ItemCreationBottomSheet.<no name provided>${}</ID> - <ID>EmptyFunctionBlock:PasswordFragment.kt$PasswordFragment.<no name provided>.<no name provided>${}</ID> - <ID>ForbiddenComment:Api30AutofillResponseBuilder.kt$Api30AutofillResponseBuilder$// TODO: Support multi-step authentication flows in apps via FLAG_DELAY_SAVE</ID> - <ID>ForbiddenComment:AutofillResponseBuilder.kt$AutofillResponseBuilder$// TODO: Support multi-step authentication flows in apps via FLAG_DELAY_SAVE</ID> - <ID>ForbiddenComment:AutofillResponseBuilder.kt$AutofillResponseBuilder.Companion$// FIXME: We should clone the original dataset here and add the credentials to be filled</ID> - <ID>ForbiddenComment:OreoAutofillService.kt$OreoAutofillService.Companion$// TODO: Provide a user-configurable denylist</ID> - <ID>ImplicitDefaultLocale:PasswordExportService.kt$PasswordExportService$String.format("%tFT%<tRZ", Calendar.getInstance(TimeZone.getTimeZone("Z")))</ID> - <ID>LongMethod:AutofillFilterView.kt$AutofillFilterView$private fun bindUI()</ID> - <ID>LongMethod:CredentialFinder.kt$CredentialFinder$override fun askForPassword(cont: Continuation<String?>, isRetry: Boolean)</ID> - <ID>LongMethod:GeneralSettings.kt$GeneralSettings$override fun provideSettings(builder: PreferenceScreen.Builder)</ID> - <ID>LongMethod:GitCommandExecutor.kt$GitCommandExecutor$suspend fun execute(): Result<Unit, Throwable></ID> - <ID>LongMethod:GitServerConfigActivity.kt$GitServerConfigActivity$override fun onCreate(savedInstanceState: Bundle?)</ID> - <ID>LongMethod:GitServerConfigActivity.kt$GitServerConfigActivity$private fun cloneRepository()</ID> - <ID>LongMethod:PasswordCreationActivity.kt$PasswordCreationActivity$override fun onCreate(savedInstanceState: Bundle?)</ID> - <ID>LongMethod:PasswordCreationActivity.kt$PasswordCreationActivity$private fun encrypt()</ID> - <ID>LongMethod:PasswordFragment.kt$PasswordFragment$private fun initializePasswordList()</ID> - <ID>LongMethod:RepositorySettings.kt$RepositorySettings$override fun provideSettings(builder: PreferenceScreen.Builder)</ID> - <ID>LongMethod:SettingsActivity.kt$SettingsActivity$override fun onCreate(savedInstanceState: Bundle?)</ID> - <ID>LoopWithTooManyJumpStatements:AutofillMatcher.kt$AutofillMatcher.Companion$for ((key, value) in prefs.all) { if (!key.startsWith(PREFERENCE_PREFIX_MATCHES)) continue // We know that preferences starting with `PREFERENCE_PREFIX_MATCHES` were // created with `putStringSet`. @Suppress("UNCHECKED_CAST") val oldMatches = value as? Set<String> if (oldMatches == null) { logcat(WARN) { "Failed to read matches for $key" } continue } // Delete all matches for file locations that are going to be overwritten, then // transfer matches over to the files at their new locations. val newMatches = oldMatches .asSequence() .minus(deletePathList) .minus(oldNewPathMap.values) .map { match -> val newPath = oldNewPathMap[match] ?: return@map match logcat { "Updating match for $key: $match --> $newPath" } newPath } .toSet() if (newMatches != oldMatches) prefs.edit { putStringSet(key, newMatches) } }</ID> - <ID>LoopWithTooManyJumpStatements:ErrorMessages.kt$ErrorMessages$while (cause.cause != null) { if (cause is GitException) break val nextCause = cause.cause!! if (nextCause is RemoteException) break cause = nextCause }</ID> - <ID>MagicNumber:ClipboardService.kt$ClipboardService$1000</ID> - <ID>MagicNumber:ClipboardService.kt$ClipboardService$1000L</ID> - <ID>MagicNumber:ClipboardService.kt$ClipboardService$45</ID> - <ID>MagicNumber:ClipboardService.kt$ClipboardService$500</ID> - <ID>MagicNumber:DicewareModule.kt$DicewareModule$6</ID> - <ID>MagicNumber:DicewarePasswordGeneratorDialogFragment.kt$DicewarePasswordGeneratorDialogFragment$5</ID> - <ID>MagicNumber:Extensions.kt$1000</ID> - <ID>MagicNumber:GitConfigActivity.kt$GitConfigActivity$0.5f</ID> - <ID>MagicNumber:GitConfigActivity.kt$GitConfigActivity$500</ID> - <ID>MagicNumber:GitConfigActivity.kt$GitConfigActivity$8</ID> - <ID>MagicNumber:GitLogAdapter.kt$8</ID> - <ID>MagicNumber:GitServerConfigActivity.kt$GitServerConfigActivity$500</ID> - <ID>MagicNumber:LaunchActivity.kt$LaunchActivity$500L</ID> - <ID>MagicNumber:PasswordExportService.kt$PasswordExportService$1024</ID> - <ID>MagicNumber:PasswordGeneratorDialogFragment.kt$PasswordGeneratorDialogFragment$20</ID> - <ID>MagicNumber:PasswordItemRecyclerAdapter.kt$PasswordItemRecyclerAdapter.PasswordItemViewHolder$0.7f</ID> - <ID>MagicNumber:ProxySelectorActivity.kt$ProxySelectorActivity$500</ID> - <ID>MagicNumber:SshKey.kt$SshKey$100_000</ID> - <ID>MagicNumber:SshKey.kt$SshKey$15</ID> - <ID>MagicNumber:SshKey.kt$SshKey$30</ID> - <ID>MagicNumber:SshKey.kt$SshKey.Algorithm.Ecdsa$256</ID> - <ID>MagicNumber:SshKey.kt$SshKey.Algorithm.Rsa$3072</ID> - <ID>MagicNumber:SshjSessionFactory.kt$SshjSession$22</ID> - <ID>MatchingDeclarationName:AutofillViewUtils.kt$DatasetMetadata</ID> - <ID>MaxLineLength:BaseGitActivity.kt$BaseGitActivity$"The server does not support multiple Git operations per SSH session. Please try again, a slower fallback mode will be used."</ID> - <ID>MaxLineLength:BaseGitActivity.kt$BaseGitActivity$"WARNING: The remote host key has changed. If this is expected, please go to Git server settings and clear the saved host key."</ID> - <ID>NestedBlockDepth:FieldItemAdapter.kt$FieldItemAdapter.FieldItemViewHolder$fun bind(fieldItem: FieldItem, showPassword: Boolean, copyTextToClipboard: (String?) -> Unit)</ID> - <ID>NestedBlockDepth:GitOperation.kt$GitOperation$suspend fun executeAfterAuthentication(authMode: AuthMode): Result<Unit, Throwable></ID> - <ID>NestedBlockDepth:PasswordExportService.kt$PasswordExportService$override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int</ID> - <ID>ReturnCount:Api30AutofillResponseBuilder.kt$Api30AutofillResponseBuilder$private fun makeFillOtpFromSmsDataset( context: Context, imeSpec: InlinePresentationSpec? ): Dataset?</ID> - <ID>ReturnCount:Api30AutofillResponseBuilder.kt$Api30AutofillResponseBuilder$private fun makeSaveInfo(): SaveInfo?</ID> - <ID>ReturnCount:AutofillDecryptActivity.kt$AutofillDecryptActivity$private suspend fun decryptCredential(file: File, password: String): Credentials?</ID> - <ID>ReturnCount:AutofillResponseBuilder.kt$AutofillResponseBuilder$private fun makeFillOtpFromSmsDataset(context: Context): Dataset?</ID> - <ID>ReturnCount:AutofillResponseBuilder.kt$AutofillResponseBuilder$private fun makeSaveInfo(): SaveInfo?</ID> - <ID>ReturnCount:AutofillViewUtils.kt$@SuppressLint("RestrictedApi") fun makeInlinePresentation( context: Context, imeSpec: InlinePresentationSpec, metadata: DatasetMetadata ): InlinePresentation?</ID> - <ID>ReturnCount:BaseGitActivity.kt$BaseGitActivity$suspend fun launchGitOperation(operation: GitOp): Result<Unit, Throwable></ID> - <ID>ReturnCount:ClipboardService.kt$ClipboardService$override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int</ID> - <ID>ReturnCount:Extensions.kt$fun File.contains(other: File): Boolean</ID> - <ID>ReturnCount:GitOperation.kt$GitOperation$suspend fun executeAfterAuthentication(authMode: AuthMode): Result<Unit, Throwable></ID> - <ID>ReturnCount:GitSettings.kt$GitSettings$fun updateConnectionSettingsIfValid( newAuthMode: AuthMode, newUrl: String ): UpdateConnectionSettingsResult</ID> - <ID>ReturnCount:OreoAutofillService.kt$OreoAutofillService$override fun onFillRequest( request: FillRequest, cancellationSignal: CancellationSignal, callback: FillCallback )</ID> - <ID>ReturnCount:OreoAutofillService.kt$OreoAutofillService$override fun onSaveRequest(request: SaveRequest, callback: SaveCallback)</ID> - <ID>ReturnCount:PasswordRepository.kt$PasswordRepository$fun getCurrentBranch(): String?</ID> - <ID>ReturnCount:PasswordStore.kt$PasswordStore$override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean</ID> - <ID>ReturnCount:ShortcutHandler.kt$ShortcutHandler$fun addPinnedShortcut(item: PasswordItem, intent: Intent)</ID> - <ID>SpreadOperator:Api30AutofillResponseBuilder.kt$Api30AutofillResponseBuilder$(*ignoredIds.toTypedArray())</ID> - <ID>SpreadOperator:AutofillResponseBuilder.kt$AutofillResponseBuilder$(*ignoredIds.toTypedArray())</ID> - <ID>SpreadOperator:BreakOutOfDetached.kt$BreakOutOfDetached$( // abort the rebase git.rebase().setOperation(RebaseCommand.Operation.ABORT), *resetCommands, )</ID> - <ID>SpreadOperator:BreakOutOfDetached.kt$BreakOutOfDetached$( // reset hard back to our local HEAD git.reset().setMode(ResetCommand.ResetType.HARD), *resetCommands, )</ID> - <ID>SpreadOperator:ErrorMessages.kt$GitException$(res, *fmt)</ID> - <ID>SpreadOperator:ErrorMessages.kt$GitException.PullException$(res, *fmt)</ID> - <ID>SpreadOperator:ErrorMessages.kt$GitException.PushException$(res, *fmt)</ID> - <ID>ThrowsCount:GitCommandExecutor.kt$GitCommandExecutor$suspend fun execute(): Result<Unit, Throwable></ID> - <ID>ThrowsCount:SshKey.kt$SshKey$fun import(uri: Uri)</ID> - <ID>TooManyFunctions:AbstractLogger.kt$AbstractLogger : Logger</ID> - <ID>TooManyFunctions:PasswordStore.kt$PasswordStore : BaseGitActivity</ID> - <ID>TopLevelPropertyNaming:AutofillMatcher.kt$private const val PREFERENCES_AUTOFILL_APP_MATCHES = "oreo_autofill_app_matches"</ID> - <ID>TopLevelPropertyNaming:AutofillMatcher.kt$private const val PREFERENCES_AUTOFILL_WEB_MATCHES = "oreo_autofill_web_matches"</ID> - <ID>TopLevelPropertyNaming:PasswordStore.kt$const val PASSWORD_FRAGMENT_TAG = "PasswordsList"</ID> - <ID>TopLevelPropertyNaming:SshKey.kt$private const val ANDROIDX_SECURITY_KEYSET_PREF_NAME = "androidx_sshkey_keyset_prefs"</ID> - <ID>TopLevelPropertyNaming:SshKey.kt$private const val KEYSTORE_ALIAS = "sshkey"</ID> - <ID>TopLevelPropertyNaming:SshKey.kt$private const val PROVIDER_ANDROID_KEY_STORE = "AndroidKeyStore"</ID> - <ID>UseCheckOrError:CredentialFinder.kt$CredentialFinder$throw IllegalStateException("Only SshKey and Password connection mode ask for passwords")</ID> - <ID>UseCheckOrError:FragmentViewBindingDelegate.kt$FragmentViewBindingDelegate$throw IllegalStateException( "Should not attempt to get bindings when Fragment views are destroyed." )</ID> - <ID>UseCheckOrError:GitOperation.kt$GitOperation$throw IllegalStateException("Biometric authentication failures should be ignored")</ID> - <ID>UseCheckOrError:PGPKeyImportActivity.kt$PGPKeyImportActivity$throw IllegalStateException("Failed to open selected file")</ID> - <ID>UseCheckOrError:SshKey.kt$SshKey$throw IllegalStateException("SSH key does not exist in Keystore")</ID> - <ID>UseCheckOrError:SshKeyGenActivity.kt$SshKeyGenActivity$throw IllegalStateException("Impossible key type selection")</ID> - <ID>UtilityClassWithPublicConstructor:AutofillMatcher.kt$AutofillMatcher</ID> - <ID>WildcardImport:Application.kt$import androidx.appcompat.app.AppCompatDelegate.*</ID> - </CurrentIssues> -</SmellBaseline> diff --git a/detekt-baselines/autofill-parser.xml b/detekt-baselines/autofill-parser.xml deleted file mode 100644 index 9a7f95f7..00000000 --- a/detekt-baselines/autofill-parser.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" ?> -<SmellBaseline> - <ManuallySuppressedIssues></ManuallySuppressedIssues> - <CurrentIssues> - <ID>DestructuringDeclarationWithTooManyEntries:AutofillStrategyDsl.kt$AutofillRule$(type, matcher, optional, matchHidden)</ID> - <ID>ForbiddenComment:AutofillFormParser.kt$AutofillFormParser$// TODO: Support WebViews in apps via Digital Asset Links</ID> - <ID>ForbiddenComment:AutofillStrategy.kt$// TODO: Introduce a custom fill/generate/update flow for this scenario</ID> - <ID>ForbiddenComment:FormField.kt$FormField$// TODO: Revisit this decision in the future</ID> - <ID>LongMethod:ByteArray.kt$@Suppress("ComplexMethod", "NestedBlockDepth") internal fun ByteArray.binarySearch(labels: List<ByteArray>, labelIndex: Int): String?</ID> - <ID>LoopWithTooManyJumpStatements:AutofillStrategyDsl.kt$PairOfFieldsMatcher$for ((i, tieBreaker) in tieBreakers.withIndex()) { val new = current.filter { tieBreaker(it, alreadyMatched) } if (new.isEmpty()) { logcat { "Tie breaker #${i + 1}: Didn't match any pair of fields; skipping" } continue } // and return if the available options have been narrowed to a single field. if (new.size == 1) { logcat { "Tie breaker #${i + 1}: Success" } current = new break } logcat { "Tie breaker #${i + 1}: Matched ${new.size} pairs of fields; continuing" } current = new }</ID> - <ID>LoopWithTooManyJumpStatements:AutofillStrategyDsl.kt$SingleFieldMatcher$for ((i, tieBreaker) in tieBreakers.withIndex()) { // Successively filter matched fields via tie breakers... val new = current.filter { tieBreaker(it, alreadyMatched) } // skipping those tie breakers that are not satisfied for any remaining field... if (new.isEmpty()) { logcat { "Tie breaker #${i + 1}: Didn't match any field; skipping" } continue } // and return if the available options have been narrowed to a single field. if (new.size == 1) { logcat { "Tie breaker #${i + 1}: Success" } current = new break } logcat { "Tie breaker #${i + 1}: Matched ${new.size} fields; continuing" } current = new }</ID> - <ID>LoopWithTooManyJumpStatements:ByteArray.kt$while (true) { val byte0 = if (expectDot) { expectDot = false '.'.code.toByte() } else { labels[currentLabelIndex][currentLabelByteIndex] and BITMASK } val byte1 = this[start + publicSuffixByteIndex] and BITMASK // Compare the bytes. Note that the file stores UTF-8 encoded bytes, so we must compare // the // unsigned bytes. compareResult = (byte0.toUByte() - byte1.toUByte()).toInt() if (compareResult != 0) { break } publicSuffixByteIndex++ currentLabelByteIndex++ if (publicSuffixByteIndex == publicSuffixLength) { break } if (labels[currentLabelIndex].size == currentLabelByteIndex) { // We've exhausted our current label. Either there are more labels to compare, in // which // case we expect a dot as the next character. Otherwise, we've checked all our // labels. if (currentLabelIndex == labels.size - 1) { break } else { currentLabelIndex++ currentLabelByteIndex = -1 expectDot = true } } }</ID> - <ID>MagicNumber:AutofillHelper.kt$FixedSaveCallback$29</ID> - <ID>MagicNumber:AutofillScenario.kt$4</ID> - <ID>MagicNumber:AutofillScenario.kt$5</ID> - <ID>MaxLineLength:FormField.kt$FormField$"\"$hint\", \"$fieldId\"${if (isFocused) ", focused" else ""}${if (isVisible) ", visible" else ""}, $webOrigin, $htmlAttributesDebug, $autofillHints"</ID> - <ID>ReturnCount:AutofillFormParser.kt$AutofillFormParser$private fun determineFormOrigin(context: Context): FormOrigin?</ID> - <ID>ReturnCount:AutofillFormParser.kt$AutofillFormParser$private fun webOriginToFormOrigin(context: Context, origin: String): FormOrigin?</ID> - <ID>ReturnCount:AutofillFormParser.kt$FormOrigin.Companion$public fun fromBundle(bundle: Bundle): FormOrigin?</ID> - <ID>ReturnCount:AutofillStrategyDsl.kt$AutofillRule$fun match( allPassword: List<FormField>, allUsername: List<FormField>, allOtp: List<FormField>, singleOriginMode: Boolean, isManualRequest: Boolean ): AutofillScenario<FormField>?</ID> - <ID>ReturnCount:PublicSuffixListCache.kt$private fun getSuffixPlusUpToOne(domain: String, suffix: String): String?</ID> - <ID>ReturnCount:PublicSuffixListData.kt$PublicSuffixListData$private fun findExceptionMatch(labels: List<ByteArray>, wildcardMatch: String?): String?</ID> - <ID>ReturnCount:PublicSuffixListData.kt$PublicSuffixListData$private fun findMatchingRule(domainLabels: List<String>): List<String></ID> - <ID>TooGenericExceptionCaught:AutofillScenario.kt$AutofillScenario.Companion$e: Throwable</ID> - <ID>TopLevelPropertyNaming:PublicSuffixListLoader.kt$private const val PUBLIC_SUFFIX_LIST_FILE = "publicsuffixes"</ID> - <ID>UnusedPrivateMember:AutofillStrategy.kt$private inline fun <T> Pair<T, T>.none(predicate: T.() -> Boolean)</ID> - <ID>UnusedPrivateMember:FormField.kt$FormField$// Ignored for now, see excludedByHints private val excludedByAutocompleteHint = htmlAutocomplete == "off"</ID> - </CurrentIssues> -</SmellBaseline> diff --git a/detekt-baselines/coroutine-utils.xml b/detekt-baselines/coroutine-utils.xml deleted file mode 100644 index 6d7bc820..00000000 --- a/detekt-baselines/coroutine-utils.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<SmellBaseline> - <ManuallySuppressedIssues> - <ID>TooGenericExceptionCaught:RunSuspendCatching.kt$e: Throwable</ID> - </ManuallySuppressedIssues> - <CurrentIssues> - <ID>TooGenericExceptionCaught:RunSuspendCatching.kt$e: Throwable</ID> - </CurrentIssues> -</SmellBaseline> diff --git a/detekt-baselines/crypto-pgpainless.xml b/detekt-baselines/crypto-pgpainless.xml deleted file mode 100644 index c3e6912d..00000000 --- a/detekt-baselines/crypto-pgpainless.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<SmellBaseline> - <ManuallySuppressedIssues/> - <CurrentIssues> - <ID>ForbiddenComment:PGPKeyManager.kt$PGPKeyManager$// TODO: This is a temp hack for now and in future it should check that the GPGKeyManager can</ID> - </CurrentIssues> -</SmellBaseline> diff --git a/detekt-baselines/format-common.xml b/detekt-baselines/format-common.xml deleted file mode 100644 index 1d731d42..00000000 --- a/detekt-baselines/format-common.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" ?> -<SmellBaseline> - <ManuallySuppressedIssues></ManuallySuppressedIssues> - <CurrentIssues> - <ID>MaxLineLength:UriTotpFinderTest.kt$UriTotpFinderTest.Companion$"otpauth://totp/ACME%20Co:john@example.com?secret=HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ&issuer=ACME%20Co&algorithm=SHA256&digits=12&period=25"</ID> - <ID>ReturnCount:UriTotpFinder.kt$UriTotpFinder$override fun findSecret(content: String): String?</ID> - </CurrentIssues> -</SmellBaseline> diff --git a/detekt-baselines/random.xml b/detekt-baselines/random.xml deleted file mode 100644 index d4728260..00000000 --- a/detekt-baselines/random.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" ?> -<SmellBaseline> - <ManuallySuppressedIssues></ManuallySuppressedIssues> - <CurrentIssues> - <ID>ComplexCondition:RandomPhonemesGenerator.kt$RandomPhonemesGenerator$!candidate.flags.hasFlag(nextBasicType) || (isStartOfPart && candidate.flags hasFlag NOT_FIRST) || // Don't let a diphthong that starts with a vowel follow a vowel. (previousFlags hasFlag VOWEL && candidate.flags hasFlag VOWEL && candidate.flags hasFlag DIPHTHONG) || // Don't add multi-character candidates if we would go over the targetLength. (password.length + candidate.length > targetLength) || (pwFlags hasFlag PasswordGenerator.NO_AMBIGUOUS && candidate.isAmbiguous)</ID> - <ID>LongMethod:RandomPhonemesGenerator.kt$RandomPhonemesGenerator$fun generate(targetLength: Int, pwFlags: Int): String?</ID> - <ID>LoopWithTooManyJumpStatements:RandomPhonemesGenerator.kt$RandomPhonemesGenerator$while (password.length < targetLength) { // First part: Add a single letter or pronounceable pair of letters in varying case. val candidate = elements.secureRandomElement() // Reroll if the candidate does not fulfill the current requirements. if ( !candidate.flags.hasFlag(nextBasicType) || (isStartOfPart && candidate.flags hasFlag NOT_FIRST) || // Don't let a diphthong that starts with a vowel follow a vowel. (previousFlags hasFlag VOWEL && candidate.flags hasFlag VOWEL && candidate.flags hasFlag DIPHTHONG) || // Don't add multi-character candidates if we would go over the targetLength. (password.length + candidate.length > targetLength) || (pwFlags hasFlag PasswordGenerator.NO_AMBIGUOUS && candidate.isAmbiguous) ) { continue } // At this point the candidate could be appended to the password, but we still have // to determine the case. If no upper case characters are required, we don't add // any. val useUpperIfBothCasesAllowed = (isStartOfPart || candidate.flags hasFlag CONSONANT) && secureRandomBiasedBoolean(20) password += if ( pwFlags hasFlag PasswordGenerator.UPPERS && (!(pwFlags hasFlag PasswordGenerator.LOWERS) || useUpperIfBothCasesAllowed) ) { candidate.upperCase } else { candidate.lowerCase } // We ensured above that we will not go above the target length. check(password.length <= targetLength) if (password.length == targetLength) break // Second part: Add digits and symbols with a certain probability (if requested) if // they would not directly follow the first character in a pronounceable part. if ( !isStartOfPart && pwFlags hasFlag PasswordGenerator.DIGITS && secureRandomBiasedBoolean(30) ) { var randomDigit: Char do { randomDigit = secureRandomNumber(10).toString(10).first() } while ( pwFlags hasFlag PasswordGenerator.NO_AMBIGUOUS && randomDigit in PasswordGenerator.AMBIGUOUS_STR ) password += randomDigit // Begin a new pronounceable part after every digit. isStartOfPart = true nextBasicType = if (secureRandomBoolean()) VOWEL else CONSONANT previousFlags = 0 continue } if ( !isStartOfPart && pwFlags hasFlag PasswordGenerator.SYMBOLS && secureRandomBiasedBoolean(20) ) { var randomSymbol: Char do { randomSymbol = PasswordGenerator.SYMBOLS_STR.secureRandomCharacter() } while ( pwFlags hasFlag PasswordGenerator.NO_AMBIGUOUS && randomSymbol in PasswordGenerator.AMBIGUOUS_STR ) password += randomSymbol // Continue the password generation as if nothing was added. } // Third part: Determine the basic type of the next character depending on the letter // we just added. nextBasicType = when { candidate.flags.hasFlag(CONSONANT) -> VOWEL previousFlags.hasFlag(VOWEL) || candidate.flags.hasFlag(DIPHTHONG) || secureRandomBiasedBoolean(60) -> CONSONANT else -> VOWEL } previousFlags = candidate.flags isStartOfPart = false }</ID> - <ID>MagicNumber:PasswordGenerator.kt$PasswordGenerator$1000</ID> - <ID>MagicNumber:PasswordGenerator.kt$PasswordGenerator$6</ID> - <ID>MagicNumber:RandomNumberGenerator.kt$100</ID> - <ID>MagicNumber:RandomNumberGenerator.kt$99</ID> - <ID>MagicNumber:RandomPhonemesGenerator.kt$RandomPhonemesGenerator$10</ID> - <ID>MagicNumber:RandomPhonemesGenerator.kt$RandomPhonemesGenerator$20</ID> - <ID>MagicNumber:RandomPhonemesGenerator.kt$RandomPhonemesGenerator$30</ID> - <ID>MagicNumber:RandomPhonemesGenerator.kt$RandomPhonemesGenerator$60</ID> - <ID>ReturnCount:PasswordGenerator.kt$PasswordGenerator$internal fun isValidPassword(password: String, pwFlags: Int): Boolean</ID> - <ID>ThrowsCount:PasswordGenerator.kt$PasswordGenerator$@Throws(PasswordGeneratorException::class) public fun generate(passwordOptions: List<PasswordOption>, length: Int = DEFAULT_LENGTH): String</ID> - </CurrentIssues> -</SmellBaseline> diff --git a/detekt-baselines/sentry-stub.xml b/detekt-baselines/sentry-stub.xml deleted file mode 100644 index 108ff262..00000000 --- a/detekt-baselines/sentry-stub.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<SmellBaseline> - <ManuallySuppressedIssues> - <ID>EmptyFunctionBlock:Scope.kt$Scope${}</ID> - <ID>EmptyFunctionBlock:Sentry.kt$Sentry${}</ID> - </ManuallySuppressedIssues> - <CurrentIssues> - <ID>EmptyFunctionBlock:Scope.kt$Scope${}</ID> - <ID>EmptyFunctionBlock:Sentry.kt$Sentry${}</ID> - </CurrentIssues> -</SmellBaseline> diff --git a/detekt-baselines/ssh.xml b/detekt-baselines/ssh.xml deleted file mode 100644 index 51033513..00000000 --- a/detekt-baselines/ssh.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" ?> -<SmellBaseline> - <ManuallySuppressedIssues></ManuallySuppressedIssues> - <CurrentIssues> - <ID>ReturnCount:SSHKeyManager.kt$SSHKeyManager$public fun needsAuthentication(): Boolean</ID> - <ID>SwallowedException:SSHKeyManager.kt$SSHKeyManager$e: IllegalStateException</ID> - <ID>TooManyFunctions:SSHKeyManager.kt$SSHKeyManager</ID> - </CurrentIssues> -</SmellBaseline> diff --git a/detekt-baselines/ui-compose.xml b/detekt-baselines/ui-compose.xml deleted file mode 100644 index c373eea4..00000000 --- a/detekt-baselines/ui-compose.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<SmellBaseline> - <ManuallySuppressedIssues/> - <CurrentIssues/> -</SmellBaseline> diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 15cb7f4e..238133f3 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -36,7 +36,6 @@ androidx-swiperefreshlayout = "androidx.swiperefreshlayout:swiperefreshlayout:1. aps-sublimeFuzzy = "com.github.android-password-store:sublime-fuzzy:2.3.2" aps-zxingAndroidEmbedded = "com.github.android-password-store:zxing-android-embedded:4.2.1" build-agp = { module = "com.android.tools.build:gradle", version.ref = "agp" } -build-detekt = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.22.0" build-diffutils = "io.github.java-diff-utils:java-diff-utils:4.12" build-download = "de.undercouch:gradle-download-task:5.4.0" build-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } diff --git a/scripts/pre-push-hook.sh b/scripts/pre-push-hook.sh index 8917df92..dea8cedb 100644 --- a/scripts/pre-push-hook.sh +++ b/scripts/pre-push-hook.sh @@ -13,6 +13,6 @@ while read -r local_ref local_oid remote_ref remote_oid; do _=$remote_ref _=$remote_oid if [ "${local_oid}" != "${ZERO}" ]; then - "${GRADLE_EXEC}" metalavaCheckCompatibilityRelease detekt ktfmtCheck test -PslimTests + "${GRADLE_EXEC}" metalavaCheckCompatibilityRelease lint ktfmtCheck test -PslimTests fi done |