From 70db403944de04eed4bf7d568595930da30b90f4 Mon Sep 17 00:00:00 2001 From: Jesus Recio Date: Wed, 20 Nov 2024 13:05:42 +0100 Subject: [PATCH] feat: add dependency for detekt-formatting and add available fields to detekt.yml file --- config/detekt/detekt.yml | 196 +++++++++++++++++++++++++++++++- gradle/libs.versions.toml | 1 + owncloudApp/build.gradle | 1 + owncloudComLibrary/build.gradle | 1 + owncloudData/build.gradle | 1 + owncloudDomain/build.gradle | 1 + owncloudTestUtil/build.gradle | 1 + 7 files changed, 201 insertions(+), 1 deletion(-) diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index 1ad5d1301ad..afa5077a48a 100644 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -282,8 +282,202 @@ exceptions: - 'RuntimeException' - 'Throwable' +formatting: + active: false + AnnotationOnSeparateLine: + active: true + indentSize: 4 + AnnotationSpacing: + active: true + ArgumentListWrapping: + active: true + indentSize: 4 + maxLineLength: 120 + BlockCommentInitialStarAlignment: + active: true + ChainWrapping: + active: true + indentSize: 4 + ClassName: + active: false + CommentSpacing: + active: true + CommentWrapping: + active: true + indentSize: 4 + ContentReceiverMapping: + active: false + maxLineLength: 120 + indentSize: 4 + DiscouragedCommentLocation: + active: false + EnumEntryNameCase: + active: true + EnumWrapping: + active: false + intentSize: 4 + Filename: + active: true + FinalNewline: + active: true + insertFinalNewLine: true + FunKeywordSpacing: + active: true + FunctionName: + active: false + FunctionReturnTypeSpacing: + active: true + maxLineLength: 120 + FunctionSignature: + active: false + forceMultilineWhenParameterCountGreaterOrEqualThan: 2147483647 + functionBodyExpressionWrapping: 'default' + maxLineLength: 120 + indentSize: 4 + FunctionStartOfBodySpacing: + active: true + FunctionTypeReferenceSpacing: + active: true + IfElseBracing: + active: false + IfElseWrapping: + active: false + indentSize: 4 + ImportOrdering: + active: true + layout: '*,java.**,javax.**,kotlin.**,^' + Indentation: + active: true + indentSize: 4 + KdocWrapping: + active: true + indentSize: 4 + MaximumLineLength: + active: true + maxLineLength: 120 + ignoreBackTickedIdentifier: false + ModifierListSpacing: + active: true + MultiLineIfElse: + active: true + indentSize: 4 + MultilineExpressionWrapping: + active: false + indentSize: 4 + NoBlankLineBeforeRbrace: + active: true + NoBlankLineInList: + active: false + NoBlankLinesInChainedMethodCalls: + active: true + NoConsecutiveBlankLines: + active: true + NoConsecutiveComments: + active: false + NoEmptyClassBody: + active: true + NoEmptyFirstLineInClassBody: + active: false + indentSize: 4 + NoEmptyFirstLineInMethodBlock: + active: true + NoLineBreakAfterElse: + active: true + NoLineBreakBeforeAssignment: + active: true + NoMultipleSpaces: + active: true + NoSemicolons: + active: true + NoSingleLineBlockComment: + active: false + indentSize: 4 + NoTrailingSpaces: + active: true + NoUnitReturn: + active: true + NoUnusedImports: + active: true + NoWildcardImports: + active: true + packagesToUseImportOnDemandProperty: 'java.util.*,kotlinx.android.synthetic.**' + NullableTypeSpacing: + active: true + PackageName: + active: true + ParameterListSpacing: + active: false + ParameterListWrapping: + active: true + maxLineLength: 120 + indentSize: 4 + ParameterWrapping: + active: true + indentSize: 4 + MaxLineLength: 120 + PropertyName: + active: false + PropertyWrapping: + active: true + indentSize: 4 + maxLineLength: 120 + SpacingAroundAngleBrackets: + active: true + SpacingAroundColon: + active: true + SpacingAroundComma: + active: true + SpacingAroundCurly: + active: true + SpacingAroundDot: + active: true + SpacingAroundDoubleColon: + active: true + SpacingAroundKeyword: + active: true + SpacingAroundOperators: + active: true + SpacingAroundParens: + active: true + SpacingAroundRangeOperator: + active: true + SpacingAroundUnaryOperator: + active: true + SpacingBetweenDeclarationsWithAnnotations: + active: true + SpacingBetweenDeclarationsWithComments: + active: true + SpacingBetweenFunctionNameAndOpeningParenthesis: + active: true + StringTemplate: + active: true + StringTemplateIndent: + active: false + indentSize: 4 + TrailingCommaOnCallSite: + active: false + useTrailingCommaOnCallSite: true + TrailingCommaOnDeclarationSite: + active: false + useTrailingCommaOnDeclarationSite: true + TryCatchFinallySpacing: + active: false + indentSize: 4 + TypeArgumentListSpacing: + active: false + indentSize: 4 + TypeParameterListSpacing: + active: false + indentSize: 4 + UnnecessaryParenthesesBeforeTrailingLambda: + active: true + Wrapping: + active: true + indentSize: 4 + maxLineLength: 120 + libraries: - active: true + active: false ForbiddenPublicDataClass: active: true ignorePackages: ['*.internal', '*.internal.*'] diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a9deda2f568..df12f8d39a2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -81,6 +81,7 @@ androidx-test-runner = { group = "androidx.test", name = "runner", version.ref = androidx-test-uiautomator = { group = "androidx.test.uiautomator", name = "uiautomator", version.ref = "androidxTestUiAutomator" } androidx-work-runtime-ktx = { group = "androidx.work", name = "work-runtime-ktx", version.ref = "androidxWork" } coil = { group = "io.coil-kt", name = "coil", version.ref = "coil" } +detekt-formatting = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" } detekt-libraries = { module = "io.gitlab.arturbosch.detekt:detekt-rules-libraries", version.ref = "detekt" } dexopener = { group = "com.github.tmurakami", name = "dexopener", version.ref = "dexopener" } disklrucache = { group = "com.jakewharton", name = "disklrucache", version.ref = "disklrucache" } diff --git a/owncloudApp/build.gradle b/owncloudApp/build.gradle index ad2ef86b50b..1d419095ec7 100644 --- a/owncloudApp/build.gradle +++ b/owncloudApp/build.gradle @@ -87,6 +87,7 @@ dependencies { debugImplementation libs.stetho // Detekt + detektPlugins libs.detekt.formatting detektPlugins libs.detekt.libraries } diff --git a/owncloudComLibrary/build.gradle b/owncloudComLibrary/build.gradle index 5660fc75c3c..b67c6464539 100644 --- a/owncloudComLibrary/build.gradle +++ b/owncloudComLibrary/build.gradle @@ -28,6 +28,7 @@ dependencies { debugImplementation 'com.facebook.stetho:stetho-okhttp3:1.6.0' // Detekt + detektPlugins libs.detekt.formatting detektPlugins libs.detekt.libraries } diff --git a/owncloudData/build.gradle b/owncloudData/build.gradle index f0ad6aff321..7f50823a276 100644 --- a/owncloudData/build.gradle +++ b/owncloudData/build.gradle @@ -91,5 +91,6 @@ dependencies { androidTestImplementation(libs.mockk.android) { exclude module: "objenesis" } // Detekt + detektPlugins libs.detekt.formatting detektPlugins libs.detekt.libraries } diff --git a/owncloudDomain/build.gradle b/owncloudDomain/build.gradle index cf369752485..e547d68bcd2 100644 --- a/owncloudDomain/build.gradle +++ b/owncloudDomain/build.gradle @@ -47,5 +47,6 @@ dependencies { testImplementation libs.mockk // Detekt + detektPlugins libs.detekt.formatting detektPlugins libs.detekt.libraries } diff --git a/owncloudTestUtil/build.gradle b/owncloudTestUtil/build.gradle index d3a3c184176..52a902d188f 100644 --- a/owncloudTestUtil/build.gradle +++ b/owncloudTestUtil/build.gradle @@ -35,5 +35,6 @@ dependencies { implementation libs.androidx.lifecycle.livedata.ktx // Detekt + detektPlugins libs.detekt.formatting detektPlugins libs.detekt.libraries }