android-templates
android-templates copied to clipboard
Update Detekt rules for Jetpack Compose
Why
We're still using the legacy Detekt config for Jetpack Compose project, that's why Detekt reports a lot of issues related to new Jetpack Compose conventions. Hence we have to skip them by adding a lot of Suppress
annotations as a workaround.
There is a new Detekt rules for Compose should be applied to get rid of those issues.
Who Benefits?
Developers
@luongvo Currently, when we create a new project from the script, it generates both xml
and compose
project. Does it mean we will not support detekt for the xml
project after generating it? 🤔
Also @chornerman has updated the detekt rules for sample-compose
project already here. So, the consumer could check it in that sample repo.
BTW, do we need to vote on this kind of issue first? @ryan-conway
@lydiasama Yes we should vote 😆 Preferably on the discussions page, but lets migrate slowly 😉
@luongvo It's true that our Detekt config needs to be updated for Jetpack Compose, but we need to make sure that the new rules we apply don't negatively affect the developer when they choose to use XML instead.
Take function naming for example. We could update the pattern to [a-zA-Z][a-zA-Z0-9]*
from [a-z][a-zA-Z0-9]*
, but this means that all functions can be named in Pascal case which is probably not our desired outcome 😉
Personally I think we should wait for #214 to be implemented and have separate Detekt configs for XML and Compose 🙏🏻
@luongvo Currently, when we create a new project from the script, it generates both xml and compose project. Does it mean we will not support detekt for the xml project after generating it? 🤔
That should be a nice idea @lydiasama, instead of checking out from sample 💭
Also @chornerman has updated the detekt rules for sample-compose project already https://github.com/nimblehq/android-templates/pull/274. So, the consumer could check it in that sample repo.
@lydiasama Yes I see that, however, we're not having full config from https://detekt.dev/docs/introduction/compose. That needs to be updated more 🚀
@ryan-conway Yes, actually we should have different config between legacy XML and Compose projects.