AndroidDev-social / DodoForMastodon

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

Setup Detekt #37

Closed racka98 closed 1 year ago

racka98 commented 2 years ago

๐Ÿ“‘ What does this PR do?

This PR adds support for Detekt as discussed on issue #11

The rule add here are the default ones with some tweaks for Jetpack Compose. Such function naming, complexity, compose annotations and Twitter Comose Rules

โœ… Checklist

๐Ÿงช How can this PR been tested?

๐Ÿงพ Tasks Remaining: (List of tasks remaining to be implemented)

๐Ÿ–ผ๏ธ Screenshots (if applicable):

racka98 commented 1 year ago

I see some existing lines that now fail the detekt task. Are those corrections better in their own follow-up issue, or as part of this work?

@es0329 these should be opened as their own separate issue. This PR just did auto formatting but it doesn't correct those issues.

racka98 commented 1 year ago

Oops, closed by mistake when I was writing a comment

racka98 commented 1 year ago

I would love to have the whole detekt setup extracted in a separate gradle config or plugin. Would you do that in this PR or do a new one for the extraction? I'm fine with the PR itself.

Unfortunately Detekt (Ktlint too) doesn't work with precompiled script so making a plugin is impossible at the moment. This is an issue with gradle itself. The script itself will work but the IDE would not resolve anything in the file (red lines)

racka98 commented 1 year ago

Unfortunately Detekt (Ktlint too) doesn't work with precompiled script so making a plugin is impossible at the moment. This is an issue with gradle itself. The script itself will work but the IDE would not resolve anything in the file (red lines)

I wish I could find the issue # in Gradle's repo. But as you can see in the screenshot, red lines everywhere for detekt. So, making a standalone plugin is not currently possible with Kotlin gradle scripts

Screenshot 2022-11-10 203155
thebino commented 1 year ago

Unfortunately Detekt (Ktlint too) doesn't work with precompiled script so making a plugin is impossible at the moment. This is an issue with gradle itself. The script itself will work but the IDE would not resolve anything in the file (red lines)

I wish I could find the issue # in Gradle's repo. But as you can see in the screenshot, red lines everywhere for detekt. So, making a standalone plugin is not currently possible with Kotlin gradle scripts

Screenshot 2022-11-10 203155

I see, I just thought there are ~50 lines just for detekt. The build scripts are getting a little messy. I can't recall where I've seen it in a separate file / plugin. I'll try to find it in the next days