Setup detekt static analysis plugin#1123
Merged
LikeTheSalad merged 2 commits intoAug 4, 2025
Merged
Conversation
bfb2e93 to
2acf446
Compare
LikeTheSalad
approved these changes
Aug 4, 2025
Contributor
LikeTheSalad
left a comment
There was a problem hiding this comment.
I left a couple of comments, though I like the overall idea as it can provide similar benefits we get with errorprone, but for Kotlin. I'm not yet aware if this config is "too strict" or not, as I haven't worked with it yet, although I guess we can make adjustments later if needed. Thank you!
breedx-splk
reviewed
Aug 4, 2025
Contributor
breedx-splk
left a comment
There was a problem hiding this comment.
Thanks for the addition. One small downside I notice is the sudden appearance of a lot of xml in this project. :)
Contributor
|
The idea is that we should fix or configure the ruleset so there are no XML files, but I'd take those rather than have the issues that those bring up. Disabling rules that we don't care about enough to fix is always a good option |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Detekt is a static analysis program for Kotlin that is pretty commonly used on Android. I've set it up on any module that is using the Android library conventions gradle script as I think it'd be beneficial for catching potential problems and maintaining consistent formatting style in Kotlin code.
Analysis can be triggered via
./gradlew detektor./gradlew check. I've suppressed all existing warnings in the project by using a baseline file, and any subsequent warnings would fail the build. The baseline can be added to by./gradlew detektBaselinewhich will regenerate the file.If any of the default rules in the baseline seem annoying or too much of a false positive I'm pretty happy to update the PR, as specific rules can be configured or even disabled. I went with as close to the default as possible, but FWIW here are the modifications we found useful at Embrace: https://github.com/embrace-io/embrace-android-sdk/blob/main/config/detekt/detekt.yml