detekt / detekt-intellij-plugin

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

Apply Custom Rules YML voids all rules #387

Open kingargyle opened 1 year ago

kingargyle commented 1 year ago

With the latest plugin in Android Studio Dolphin, if I try to add a configuration file yml, and apply it. It appears that the rules are not applied and not even the default rules. This can be replicated simply enough by taking the default configuration file from:

https://raw.githubusercontent.com/detekt/detekt/main/detekt-core/src/main/resources/default-detekt-config.yml

And adding it as a Configuration file. Apply it, and then go to a file that you know has rules violations. No detekt rules are shown.

If you remove the file, and just go with the default from the plugin, then those rules are available and are applied as expected.

Add the custom rules back in and no detekt rules are shown.

rdoupe commented 1 year ago

I just did the same thing, and I'm seeing the same results with Intellij Ultimate 2022.2.3

rdoupe commented 1 year ago

I was able to get this working by using "Build rules upon default configuration"

image

and the following detekt.yml which overrides maxIssues and MaxLineLength

build:
  maxIssues: 99999

style:
  MaxLineLength:
    active: true
    maxLineLength: 140
    excludePackageStatements: true
    excludeImportStatements: true
    excludeCommentStatements: false
    excludeRawStrings: true

this will work for me, but it's not ideal that it doesn't work with the default config.

I also had to restart Intellij for the plugin to detekt the changes.

jack-webb commented 1 year ago

I'm seeing the same issue in AS Dolphin, plugin version 1.21.3-android. The above fix didn't work for me, though.

adrianlandborn commented 8 months ago

I still have the same issue. We have maxLineLength: 140 but the plugin still complains if we go past 120.

Any updates or workarounds?