jshiell / checkstyle-idea

CheckStyle plug-in for IntelliJ IDEA
https://plugins.jetbrains.com/plugin/1065-checkstyle-idea
Other
887 stars 161 forks source link

Autoconfigure checkstyle by conventions #618

Open mwisnicki opened 1 year ago

mwisnicki commented 1 year ago

It would have been nice if $projectDir/config/checkstyle/checkstyle.xml was automatically picked up from project.

jshiell commented 1 year ago

Checking for common locations is a potential feature, but unlikely due to knock-on effects at present - e.g. how do we manage these locations? Do we need to check them and add/remove them when the file appears/disappears? If we don't clean up, how do we handle errors? If another file is selected, do we override that if this file appears? I'm not convinced it's worth the effort at present, especially given the variety of locations where people do keep the files.

mwisnicki commented 1 year ago

I don't think I understand your concern.

There is only one location. If file is present just add it. If missing remove it. If the user doesn't like that they can rename the file.

jshiell commented 1 year ago

You have only one location - but if a feature like this is implemented it'd be dadt not to cover more common locations (e.g. people often put checkstyle.xml in the project root, or in etc as Ritchie intended). But that's the easy part, iterate over a list of locations.

The bigger problem is we're changing the contract - at present, you add the file and you manage it. If we start autodetecting, we pick up all the management problems - e.g. what if the file is removed, or if the file requires parameters to be entered and hence we can't run it without user input? And we can't just add it - e.g. when would we add it? Just check at project startup? What if the file appears - or disappears - after a git pull? What if it's on a network drive and suddently gets added/removed by another user? In short, there's lots of edge cases that need to be considered to make the feature work in a predictable, sensible way for the majority of users.

mwisnicki commented 1 year ago

Ideally should be observed but suspended around git operations. If that's too hard/too much work then just have reload action somewhere. Same as gradle, maven and other integrations.

Missing arguments and other problems don't have to be handled - presumably they will cause a filure.