-
Notifications
You must be signed in to change notification settings - Fork 7
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
New rule: Unused kotlin extensions #440
New rule: Unused kotlin extensions #440
Conversation
import modulecheck.parsing.gradle.Declaration | ||
import modulecheck.project.McProject | ||
import modulecheck.utils.LazyDeferred | ||
import modulecheck.utils.lazyDeferred | ||
import java.io.File | ||
|
||
data class UnusedKaptPluginFinding( | ||
data class UnusedPluginFinding( |
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.
Made this generic. Can be used with any unused Gradle plugin
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.
This is good!
The kapt-oriented stuff is just about the oldest code in the project, and largely unchanged. It doesn't quite fit the patterns of everything else, but it hasn't been bad enough for me to revisit it just yet.
At some point, I'm going to want to broaden the somewhat-dated KAPT checks to a more generic "code generation" scope which includes Anvil and KSP extensions.
So, this is a step in that direction. :)
e4576d2
to
d2b7985
Compare
d2b7985
to
2059703
Compare
The |
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 for this!
Don't forget that the legacy plugin also handles @Parcelize
, which fortunately has a different namespace than the current version.
I added a check for that reference to the rule, and added a test to ensure that rule doesn't give a false positive for "unused" when that older annotation is referenced.
modulecheck-core/src/main/kotlin/modulecheck/core/rule/ModuleCheckRuleFactory.kt
Outdated
Show resolved
Hide resolved
Thanks. It is great that GitHub now allows you to push into forked repos when PR is open. This was a challenge in the past. The Parcelize is there but isn't that now a separate plugin? If synthetic imports are not used, this plugin should be removed. It should be replaced by Parcelize specific one |
The two plugins use different annotation classes for old: So it could technically still be auto-fixed by replacing the plugin, but it would also require updating the Kotlin source. |
I see. I did not know about the package name change. |
Kotlin Android Extensions are officially deprecated and will be completely removed as part of Kotlin 1.8
This new rule checks if it is unused and can be removed from a module