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

Feature request: Load config from maven plugin configuration #107

Open rgrebski opened 3 years ago

rgrebski commented 3 years ago

I have detekt-maven-plugin configured in my MAven project using config file (configResource) from shared dependency (detekt-configs). I would like IntelliJ plugin to read and apply same configuration from itself whenever it finds the detekt-maven-plugin config.

                <plugin>
                    <groupId>com.github.ozsie</groupId>
                    <artifactId>detekt-maven-plugin</artifactId>
                    <version>${maven-detekt.version}</version>
                    <configuration>
                        <configResource>detekt-common.yml</configResource>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>verify</phase>
                            <goals><goal>check</goal></goals>
                            <configuration>
                                <report>
                                    <report>html:reports/detekt.html</report>
                                </report>
                            </configuration>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>pl.stepwise</groupId>
                            <artifactId>detekt-configs</artifactId>
                            <version>1.0-SNAPSHOT</version>
                        </dependency>
                    </dependencies>
                </plugin>
rgrebski commented 3 years ago

I can of course help with implementing the feature, but need some input/hints/thoughts first.

arturbosch commented 3 years ago

Hi, that would definitely be a nice feature for our maven and gradle plugin users!

I can't point you to the direct classes as I don't know them either but the general idea would be going from the main Project instance, asking some kind of a WorkspaceManager (IDEA uses a log of Manager singletons) and use this manager to search for the top level build file. I expect intellij to have some kind of build tool model interface which can be used for such cases I guess.