-
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
ANDROID-11179 detekt implementation #386
Conversation
Should we include detekt in any of our GAs? |
π± New catalog for testing generated: Download |
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.
LGTM, just one suggestion ππΌ
buildUponDefaultConfig = true | ||
config = files("$projectDir/build-tools/detekt/detekt.yml") | ||
input = files("$projectDir") | ||
} |
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.
You could exclude some folders like:
source.from(fileTree(rootProject.projectDir) {
exclude("**/.gradle/")
exclude("**/build/")
exclude("**/tmp/**")
})
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.
True, just did it, thanks
π± New catalog for testing generated: Download |
@@ -0,0 +1,12 @@ | |||
|
|||
detekt { |
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.
β¦ing more autogenerated files
π± New catalog for testing generated: Download |
π± New catalog for testing generated: Download |
β¦sue after spotting unused "a" variable
π± New catalog for testing generated: Download |
β¦ order to fix detekt's issue
β¦naming ButtonSizeConfig data class or ButtonSizes.kt
π± New catalog for testing generated: Download |
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.
π
build.gradle
Outdated
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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
True, just committed a code cleanup. Thanks!
detekt-baseline.xml
Outdated
<?xml version="1.0" ?> | ||
<SmellBaseline> | ||
<ManuallySuppressedIssues></ManuallySuppressedIssues> | ||
<CurrentIssues> | ||
<ID>WildcardImport:protect_android_task.gradle.kts$import java.io.*</ID> | ||
<ID>WildcardImport:protect_android_task.gradle.kts$import java.lang.*</ID> | ||
</CurrentIssues> | ||
</SmellBaseline> |
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.
I think we could either fix these imports or use @Supress* in that files in order not to need this baseline. I fear we'll fix this at some point and forget to remove the baseline.
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.
I did not have to fix any issues here, it was my bad. Thanks for spotting it.
Thinking it twice, it makes no sense to have an empty detekt-baseline.xml file for now, so I am deleting it.
π± New catalog for testing generated: Download |
π± New catalog for testing generated: Download |
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.
Awesome
β¦nrique/ANDROID-11179-enable-detekt-in-mistica-android # Conflicts: # README.md
π± New catalog for testing generated: Download |
π± New catalog for testing generated: Download |
Breaking changes that require a new major release? if so I would expect updates in https://github.com/Telefonica/mistica-android/blob/jmanrique/ANDROID-11179-enable-detekt-in-mistica-android/UPGRADING.md Any ticket created to tackle pending issues? |
I have just created these 3 tickets to tackle pending issues.
I have a doubt about this being a major release. I would say this is a minor one, since there are no breaking changes (I think), it is just adding new functionality (detekt) which is backward compatible. What am I missing? |
Thanks for creating those tickets! what about this https://github.com/Telefonica/mistica-android/pull/386/files#diff-16c7f6781a03c2127c9cfd4b50a25cd8ad71e464e4848fccbcc9a823e44f73bdL222-R222? |
Sorry, thanks!! I did not know that was a breaking change, I am adding it to https://github.com/Telefonica/mistica-android/blob/jmanrique/ANDROID-11179-enable-detekt-in-mistica-android/UPGRADING.md as you mentioned. |
@@ -50,6 +50,7 @@ fun Buttons() { | |||
} | |||
|
|||
@Composable | |||
@Suppress("LongMethod") |
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.
I would include an ignore to not take into account the composables as we do in platform:
LongMethod:
ignoreAnnotated: 'Composable'
In general, most of the composables will throw the long method error
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.
Great, I have just included the ignore you mentioned and there are only 2 LongMethod flagged non composable functions. Thank you!!!
@jmanriquehiberus as it's explained in that document, now the breaking changes are explained in the release notes of the new version, in this case |
Thank you! |
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.
Thanks, good job!
π± New catalog for testing generated: Download |
ποΈ Jira ticket
ANDROID-11179
π₯ What's the goal?
We need to implement detekt.
π§ How do we do it?
mistica-android/detekt-baseline.xml
Some custom code smells added so detekt can spot them (taken from android-messenger).
mistica-android/build-tools/detekt/detekt.yml
Custom definition of detekt's behaviour.
mistica-android/build-tools/detekt.gradle
Gradle file, applied from the project's build.gradle in order to override gradle's detekt.
I also fixed 57 detekt issues, most of them are fixed in atomic commits in order to ease the review. Still, there are 39 issues to be addressed which are suppressed by now. I will create now some jira tickets to tackle them.
π§ͺ How can I test this?
Run the command
./gradlew detekt
in order to run the task, modify detekt.yml and see that those new changes affect the output of the task.