diff --git a/.github/workflows/detekt.yml b/.github/workflows/detekt.yml new file mode 100644 index 00000000000..eb1d6b19ec9 --- /dev/null +++ b/.github/workflows/detekt.yml @@ -0,0 +1,62 @@ +# This is a basic workflow that is manually triggered + +name: Detekt + +# Controls when the action will run. Workflow runs when manually triggered using the UI +# or API. +on: + workflow_dispatch: + # Inputs the workflow accepts. + inputs: + name: + # Friendly description to be shown in the UI instead of 'name' + description: 'Detekt' + # Default value if no value is explicitly provided + default: 'World' + # Input has to be provided for the workflow to run + required: true + # The data type of the input + type: string + + push: + branches: + - feature/detekt + pull_request: + branches: + - "master" + paths: + - ".github/workflows/detekt.yml" + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "greet" + run: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + # Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies. + # See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md + - name: Setup Gradle + uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 + - name: Set base line + run: ./gradlew detektBaseline + - name: module owncloudApp + run: ./gradlew detekt + - name: module owncloudDomain + run: ./gradlew owncloudDomain:detekt + - name: module owncloudData + run: ./gradlew owncloudData:detekt + - name: module owncloudComLibrary + run: ./gradlew owncloudComLibrary:detekt + - name: module owncloudTestUtil + run: ./gradlew owncloudTestUtil:detekt diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index 9879910ba86..d6ffc346e34 100644 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -48,7 +48,7 @@ output-reports: # - 'HtmlOutputReport' comments: - active: true + active: false AbsentOrWrongFileLicense: active: false licenseTemplateFile: 'license.template' @@ -85,7 +85,7 @@ complexity: active: true ComplexCondition: active: true - threshold: 4 + threshold: 5 ComplexInterface: active: false threshold: 10 @@ -111,20 +111,20 @@ complexity: active: false ignoredLabels: [] LargeClass: - active: true + active: false threshold: 600 LongMethod: active: true threshold: 60 LongParameterList: - active: true + active: false functionThreshold: 6 constructorThreshold: 7 ignoreDefaultParameters: false ignoreDataClasses: true ignoreAnnotatedParameter: [] MethodOverloading: - active: false + active: true threshold: 6 NamedArguments: active: false @@ -132,7 +132,7 @@ complexity: ignoreArgumentsMatchingNames: false NestedBlockDepth: active: true - threshold: 4 + threshold: 5 ReplaceSafeCallChainWithRun: active: false StringLiteralDuplication: @@ -143,7 +143,7 @@ complexity: excludeStringsWithLessThan5Characters: true ignoreStringsRegex: '$^' TooManyFunctions: - active: true + active: false excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] thresholdInFiles: 11 thresholdInClasses: 11 @@ -157,7 +157,7 @@ complexity: coroutines: active: true GlobalCoroutineUsage: - active: false + active: true InjectDispatcher: active: false dispatcherNames: @@ -165,13 +165,13 @@ coroutines: - 'Default' - 'Unconfined' RedundantSuspendModifier: - active: false + active: true SleepInsteadOfDelay: - active: false + active: true SuspendFunWithCoroutineScopeReceiver: - active: false + active: true SuspendFunWithFlowReturnType: - active: false + active: true empty-blocks: active: true @@ -192,7 +192,7 @@ empty-blocks: active: true EmptyFunctionBlock: active: true - ignoreOverridden: false + ignoreOverridden: true EmptyIfBlock: active: true EmptyInitBlock: @@ -211,14 +211,14 @@ empty-blocks: exceptions: active: true ExceptionRaisedInUnexpectedLocation: - active: true + active: false methodNames: - 'equals' - 'finalize' - 'hashCode' - 'toString' InstanceOfCheckForException: - active: false + active: true excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] NotImplementedDeclaration: active: false @@ -259,7 +259,7 @@ exceptions: ThrowingNewInstanceOfSameException: active: true TooGenericExceptionCaught: - active: true + active: false excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] exceptionNames: - 'ArrayIndexOutOfBoundsException' @@ -368,7 +368,7 @@ performance: active: true excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] SpreadOperator: - active: true + active: false excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] UnnecessaryTemporaryInstantiation: active: true @@ -539,7 +539,7 @@ style: active: true maxJumpCount: 1 MagicNumber: - active: true + active: false excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] ignoreNumbers: - '-1' @@ -562,7 +562,7 @@ style: active: false MaxLineLength: active: true - maxLineLength: 120 + maxLineLength: 150 excludePackageStatements: true excludeImportStatements: true excludeCommentStatements: false @@ -610,7 +610,7 @@ style: SpacingBetweenPackageAndImports: active: false ThrowsCount: - active: true + active: false max: 2 excludeGuardClauses: false TrailingWhitespace: