horologist icon indicating copy to clipboard operation
horologist copied to clipboard

Add twitter compose rules check

Open luizgrp opened this issue 3 years ago • 5 comments

WHAT

Change our builds scripts to run Twitter's Jetpack Compose Rules.

WHY

So issues like https://github.com/google/horologist/pull/830 and https://github.com/google/horologist/pull/611 are detected via code analysis instead of relying on code reviews.

HOW

The ideal would be to add the plugin with spotless but it is not supported. So this ticket is to figure out a good alternative.


Below is some context from my findings in https://github.com/google/horologist/pull/610:

Kolinter could be added as temporary measure but it does not support baselines. That would force us to fix all the issues in order to add the plugin, which is not great, or suppress each of them with annotations if possible, which is also not great as it would pollute the code.

Ktlint-gradle could be used, but its version would have to be downgraded in our project as the latest version is not currently supported. If proceeding with this option, then ktlint would have to be removed from our spotless configuration, in order to not run twice.

In overall, if we are going to add a different code analysis tool, I would prefer, if possible, to remove spotless in order to have only a single tool. Our project seems to use spotless for code analysis for the reasons below, so any alternative explored would have to provide the same functionalities:

luizgrp avatar Dec 13 '22 11:12 luizgrp

Maybe moved to https://github.com/mrmans0n/compose-rules?

yschimke avatar Feb 09 '23 14:02 yschimke

Another alternative setup to try: https://github.com/slackhq/compose-lints/

luizgrp avatar Feb 09 '23 14:02 luizgrp

Apparently now ktlint-gradle works well (instead of kotlinter) with the latest ktlint version, if you go the ktlint route. They updated it not so long ago.

mrmans0n avatar Mar 13 '23 11:03 mrmans0n

This support has been finished in https://github.com/diffplug/spotless/pull/1896, we can try Spotless integration once 6.23.0 is out.

Goooler avatar Nov 22 '23 05:11 Goooler

Maybe https://github.com/j-roskopf/ComposeGuard

yschimke avatar May 20 '24 14:05 yschimke

Closing as low priority, reopen if keen to work on it.

yschimke avatar Aug 13 '24 08:08 yschimke