-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ANDROID-11179 detekt implementation #386
Changes from 21 commits
23291e2
fd59062
6baac3a
60f8f91
6c144d6
fe5535a
01bc970
5d18440
e5ff9b8
b26150e
75c1a6e
46d4262
4edc4f2
c9afd31
590835e
1584599
bfdfbac
b20c76b
910fdad
533c04d
81399b7
0e9f6c7
bada90c
ee638a9
e93dd76
3ff5363
8305ea3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
detekt { | ||
buildUponDefaultConfig = true | ||
config.from(files("$projectDir/build-tools/detekt/detekt.yml")) | ||
basePath = files("$projectDir") | ||
|
||
source.from(fileTree(rootProject.projectDir) { | ||
exclude("**/.gradle/") | ||
exclude("**/build/") | ||
exclude("**/tmp/**") | ||
exclude("**/*Autogenerated.kt") | ||
}) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could exclude some folders like:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, just did it, thanks |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
complexity: | ||
TooManyFunctions: | ||
active: false | ||
LongParameterList: | ||
active: false | ||
|
||
style: | ||
NewLineAtEndOfFile: | ||
active: false | ||
MagicNumber: | ||
active: false | ||
ReturnCount: | ||
active: false | ||
UnusedImports: | ||
active: true | ||
MaxLineLength: | ||
maxLineLength: 160 | ||
UnusedPrivateMember: | ||
ignoreAnnotated: 'Preview' | ||
UnnecessaryAbstractClass: | ||
ignoreAnnotated: "Module" | ||
|
||
naming: | ||
FunctionNaming: | ||
active: true | ||
ignoreAnnotated: 'Composable' | ||
|
||
empty-blocks: | ||
EmptyFunctionBlock: | ||
active: false | ||
|
||
exceptions: | ||
TooGenericExceptionThrown: | ||
active: false | ||
TooGenericExceptionCaught: | ||
active: false |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ buildscript { | |
accompanist_version = "0.32.0" | ||
coil_version = '2.5.0' | ||
constraintComposeVersion = '1.0.1' | ||
detekt_version = '1.23.7' | ||
roborazzi_version = "1.10.1" | ||
} | ||
repositories { | ||
|
@@ -23,13 +24,19 @@ buildscript { | |
classpath "com.android.tools.build:gradle:8.1.4" | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | ||
classpath "gradle.plugin.com.betomorrow.gradle:appcenter-plugin:2.0.3" | ||
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detekt_version" | ||
} | ||
} | ||
|
||
plugins { | ||
id 'org.jetbrains.kotlin.android' version '1.5.21' apply false | ||
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0' apply false | ||
id "io.github.takahirom.roborazzi" version '1.10.1' apply false | ||
id "io.gitlab.arturbosch.detekt" version '1.23.7' | ||
} | ||
|
||
dependencies { | ||
apply plugin: "io.gitlab.arturbosch.detekt" | ||
} | ||
|
||
allprojects { | ||
|
@@ -41,10 +48,50 @@ allprojects { | |
version = System.getProperty("LIBRARY_VERSION") ?: "undefined" | ||
} | ||
|
||
tasks.withType(io.gitlab.arturbosch.detekt.Detekt).all { | ||
exclude("build/") | ||
exclude("**/build/**") | ||
exclude("**/resources/**") | ||
exclude("**/tmp/**") | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these are also in detekt.gradle ¿are they needed in both places? ¿Perhaps if this is here the ones from detekt.gradle are not needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, just committed a code cleanup. Thanks! |
||
|
||
tasks.withType(io.gitlab.arturbosch.detekt.Detekt).configureEach { | ||
reports { | ||
html { | ||
outputLocation.set(file("$buildDir/reports/detekt/detekt-report.html")) | ||
required.set(true) | ||
} | ||
xml { | ||
outputLocation.set(file("$buildDir/reports/detekt/detekt-checkstyle.xml")) | ||
required.set(true) | ||
} | ||
} | ||
} | ||
|
||
task detektProjectBaseline(type: io.gitlab.arturbosch.detekt.DetektCreateBaselineTask) { | ||
description = "Overrides current baseline." | ||
ignoreFailures.set(true) | ||
parallel.set(true) | ||
buildUponDefaultConfig.set(true) | ||
setSource(files("$projectDir")) | ||
config.setFrom(files("$projectDir/build-tools/detekt/detekt.yml")) | ||
baseline.set(file("$projectDir/detekt-baseline.xml")) | ||
include("**/*.kt") | ||
include("**/*.kts") | ||
exclude("**/resources/**") | ||
exclude("**/build/**") | ||
exclude("**/tmp/**") | ||
} | ||
|
||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
} | ||
|
||
apply from: "${rootProject.projectDir}/publish_maven_central.gradle" | ||
apply from: "build-tools/detekt.gradle" | ||
|
||
tasks.withType(io.gitlab.arturbosch.detekt.Detekt) { | ||
autoCorrect = true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No files to adapt in mistica after adding detekt? Did you check this is executed with the ./gradlew check command? (which is the one executed on preintegration GA)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there are 96 issues to address after running detekt.
I am sorry but could not find any preintegration GA in mistica, should there be or should we include detekt in any GA? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the tests.yml file, the checks which are run on each PR commit, detekt should run as part of them.
Normally, when invoking "check" gradle target (executed on that GA), detekt is also executed with just applying the plugin, but please check it just to ensure it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to add detekt we need to also fix the current issues repository has (or ignoring them someway to do that work afterwards), if it's too complicated, please check with the team how to proceed on next weekly or by chat (I'm on vacations next week).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. By now, I have addressed 53 issues and still have 43 to be fixed (most of them related to long functions or too complex functions). I will address simpler issues alone and will keep potentially troublesome ones to be tackled along with the team.