AndroidDev-social / DodoForMastodon

🐘 Mastodon client for Android, iOS and Desktop (JVM)
GNU General Public License v3.0
384 stars 29 forks source link

[FEAT]: Add Detekt & Lint checker to project #11

Closed crocsandcoffee closed 1 year ago

crocsandcoffee commented 2 years ago

Description

https://detekt.dev/ https://pinterest.github.io/ktlint/

At some point it would be nice to get these setup in the project so developers can focus more on contributions and have these checkers as part of CI.

Additional Information

No response

WhosNickDoglio commented 2 years ago

It's worth mentioning the detekt formatting rules just wrap ktlint rules so you can use detekt to cover both rulesets without adding another plugin for ktlint.

JacquesSmuts commented 2 years ago

Ktlint comes with an autoformatter which makes it easy to automatically fix the formatting failure, or even prevent it by adding it to a pre-commit hook.

This would save everyone a lot of time.

As far as I'm aware, Detekt doesn't have an autoformatter like that?

racka98 commented 2 years ago

Detekt does support auto formatting based on ktlint. See: https://github.com/ReluctApp/Reluct/blob/c9de419e966abbf7e686ac7752dbe46178da2fc5/build.gradle.kts#L80

svenjacobs commented 2 years ago

We could also use Twitter's 😉 Compose Rules. It's really nice because it also catches common Compose errors / gotchas.

rafsanjani commented 2 years ago

As part of this task, we could also add some git hooks to auto-format and catch rule violations before code is pushed to GH

thebino commented 2 years ago

While you all write so much comments into this issue, you could probably have it added already 😂 Fill a PR and let's start coding in style

svenjacobs commented 2 years ago

I made good experience with the Kotlinter Gradle plugin. It also offers a Git hook.

bitPogo commented 2 years ago

Maybe spotless with ktlint is an option.

crocsandcoffee commented 2 years ago

@racka98 plz make PR to upstream main. Thanks for taking the initiative and throwing something together. We can look over the setup you did in the PR and go from there.

racka98 commented 2 years ago

@crocsandcoffee see #37