Android RuleSet #3303
Replies: 3 comments 2 replies
-
Adding a first-party plugin makes sense. Note that we should be able to add the dependency on Android ruleset when we are applying the android flavor of The idea pool is even bigger: Android lint checks. Since Android Lint has to support all Android file types, including Java, Kotlin, and XML, running a new rule in Android lint is generally slower than a detekt rule. In the repo I am working on, we run detekt as a git-commit hook (Usually 2s for the changed files), but we run Android Lint only on CI (Because it takes 10 minutes to run). |
Beta Was this translation helpful? Give feedback.
-
I think that's a great idea. I also recall having a lot of discussions for Android-specific configuration of plain detekt rules (something related to #2231) Are we planning to address this as well? |
Beta Was this translation helpful? Give feedback.
-
One rule that I miss: Intent(context, XXXActivity::class.java) This code should be only found inside the |
Beta Was this translation helpful? Give feedback.
-
Lately we have some active contributors in the project that have an Android background. And there were some comments about some rules that for Android doesn't fit very well. Or some rules that only have sense in the Android context, etc. There were some comments about creating an Android rule set too but there were offtopic ideas in other PR/issues.
So, I will like to talk about the creation of a new RuleSet (or even multiple) for Android. I see multiple ways to do this:
I think that the first-party plugin have more sense. A plugin under the "detekt umbrella" but not in the core repository. My reasons:
Ideas for rules in the ruleset:
Serializable
interface in a Bundle nor an Intent.Intent(context, SomeActivity::class)
outside the companion object ofSomeActivity
. (Use the patternSomeActivity.getCallingIntent()
)SomeFragment()
constructor outside the companion object ofSomeFragment
. (Use the patternSomeFragment.newInstance()
)Activity
instead ofAppCompatActivity
Beta Was this translation helpful? Give feedback.
All reactions