detekt / detekt-intellij-plugin

detekt plugin for IntelliJ
https://plugins.jetbrains.com/plugin/10761-detekt
Apache License 2.0
299 stars 39 forks source link

How to use 3rd party rules? #474

Closed pokk closed 1 year ago

pokk commented 1 year ago

Just a quick question, if this place is not for the question, I will remove this.

I would like to set Twitter-compose rules on my AS IDE. My setting might be wrong, could you please let me know how to set it?

2023-04-20-8-28-55

According to https://twitter.github.io/compose-rules/rules/#preview-composables-should-not-be-public, here is supposed to have a warning or error.

2023-04-20-8-31-03
arturbosch commented 1 year ago

Hi, please try if the compose rule set works for you with the cli: https://twitter.github.io/compose-rules/detekt/#using-with-detekt-cli You can use --debug to print the loaded rule sets. When I include the compose rule set, detekt picks it up: Screenshot from 2023-04-20 20-41-04

(However I do not have any compose project to test this, so it might be some rule configuration is missing or the compose rule set requires type resolution ?

pokk commented 1 year ago

@arturbosch

Thank you so much for the quick reply. I have tried the cli, and it does work well. Just wondering that my setting might be wrong. If the detekt plugins has't support it. It might be a good feature for the plugin 🙇‍♂️

arturbosch commented 1 year ago

@arturbosch

Thank you so much for the quick reply. I have tried the cli, and it does work well. Just wondering that my setting might be wrong. If the detekt plugins has't support it. It might be a good feature for the plugin bowing_man

I'm not sure if the intellij plugin now also reports the compose issue or just the cli? If it does not, maybe you could setup a minimal project where I could take a look?

pokk commented 1 year ago

I will let you know after I check it if it does work or not. 🙇‍♂️

pokk commented 1 year ago

@arturbosch

So sorry for being late.

I got the lint errors from the jar file for a new project without any other settings.

2023-05-03-2-55-16

This is my setting

2023-05-03-2-56-29


I added the detekt.yml together.

2023-05-03-2-59-18

It works well, too!!! 👍

2023-05-03-3-00-06

I was looking for this rule, seems it has a note that I didn't pay attention to it. 🙏

After trying many ways, I figured out I added baseline.yml to

2023-05-03-3-10-47

<?xml version="1.0" ?>
<SmellBaseline>
  <Blacklist></Blacklist>
  <Whitelist></Whitelist>
</SmellBaseline>

Sorry for the dumb question here. Didn't use the correct way to import the rules. 🙇‍♂️