detekt / detekt-intellij-plugin

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

AutoCorrect is not working when right clicking the directory #512

Open mondaylord opened 6 months ago

mondaylord commented 6 months ago

Description

Autocorrect works as expected when I right-click a file or a blank space within the code in the IDE.

However, when I attempt to run autocorrect by right-clicking on the directory itself, it does not work. This behavior persists even when the directory contains only one kotlin file.

I am not sure if this is a bug or an intentional feature that autocorrect cannot be executed on a directory.

arturbosch commented 5 months ago

AutoCorrect was implemented to run just on a single file:

https://github.com/detekt/detekt-intellij-plugin/blob/31e25cb28c9cb9c4238f8a64384ea00b0511cdfd/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/AutoCorrectAction.kt#L27

detekt core should be able to handle directories and the plugin can be updates to support directories like the RunAnalysionAction

https://github.com/detekt/detekt-intellij-plugin/blob/31e25cb28c9cb9c4238f8a64384ea00b0511cdfd/src/main/kotlin/io/gitlab/arturbosch/detekt/idea/action/RunAnalysisAction.kt#L25-L36: