Android
detekt 1.19.0
When running this commmand I get the following output but not classes that have failed for the rules.
./gradlew detekt
37 kotlin files were analyzed.
Complexity Report:
- 1,377 lines of code (loc)
- 1,130 source lines of code (sloc)
- 689 logical lines of code (lloc)
- 19 comment lines of code (cloc)
- 118 cyclomatic complexity (mcc)
- 13 cognitive complexity
- 0 number of total code smells
- 1% comment source ratio
- 171 mcc per 1,000 lloc
- 0 code smells per 1,000 lloc
Project Statistics:
- number of properties: 71
- number of functions: 103
- number of classes: 36
- number of packages: 17
- number of kt files: 37
Successfully generated SARIF: a standard format for the output of static analysis tools at /home/steve/androidProjects/Pokemon/app/build/reports/detekt/detekt.sarif
Successfully generated HTML report at /home/steve/androidProjects/Pokemon/app/build/reports/detekt/detekt.html
Successfully generated Checkstyle XML report at /home/steve/androidProjects/Pokemon/app/build/reports/detekt/detekt.xml
Successfully generated plain text report at /home/steve/androidProjects/Pokemon/app/build/reports/detekt/detekt.txt
But it doesn't tell me the problems.
When I run this from github actions in my android.yml
file with this command:
- name: "Run detekt rules"
uses: natiginfo/action-detekt-all@1.17.0
I will get the following on my PR which give me the information I am looking for.
complexity - 1h debt
TooManyFunctions - 12/11 - [PokemonViewModel] at /github/workspace/app/src/main/java/me/androidbox/pokemon/presentation/viewmodels/PokemonViewModel.kt:22:7
TooManyFunctions - 14/11 - [DependencyHandlerExtensions.kt] at /github/workspace/buildSrc/src/main/kotlin/DependencyHandlerExtensions.kt:1:1
TooManyFunctions - 15/11 - [Dependencies.kt] at /github/workspace/buildSrc/src/main/kotlin/Dependencies.kt:1:1
naming - 15min debt
MatchingDeclarationName - [ViewScope] at /github/workspace/app/src/main/java/me/androidbox/pokemon/di/scopes/PokemonScope.kt:5:1
FunctionParameterNaming - [_isTransitive] at /github/workspace/buildSrc/src/main/kotlin/DependencyHandlerExtensions.kt:18:76
FunctionNaming - [UITesting] at /github/workspace/buildSrc/src/main/kotlin/Dependencies.kt:195:23
style - 9h 5min debt
However, I would like to get the same information when running locally, rather than waiting for the PR to run on github actions.
Is there any way to do this from the command line locally?
I need to add this to my top level gradle build file
subprojects {
apply(plugin = "io.gitlab.arturbosch.detekt")
detekt {
config = files("${rootDir}/detekt.yml")
allRules = true
buildUponDefaultConfig = true
reports {
}
}
}