checkstyle-idea icon indicating copy to clipboard operation
checkstyle-idea copied to clipboard

"Check All Modified Files" checks staged added files but not unstaged added files

Open TysonMN opened this issue 2 years ago • 4 comments

In the CheckStyle window, there is a button with hovertext that says

Check All Modified Files

When this button is clicked, the files it considers include

  • edited and unstaged
  • edited and staged
  • added and staged

The files it does not consider include

  • added and unstaged

I would prefer if added and unstaged files were also considered.

Is this something that the maintainers are willing to change?


Video showing that

  • edited and unstaged files are considered
  • added and unstaged files not considered
  • added and staged files are considered

Screen Recording 2022-04-07 at 8 39 07 PM

Video is created with CheckStyle version: 5.63.0

TysonMN avatar Apr 08 '22 02:04 TysonMN

After looking at

...the only possible alternative implementations that I see would involve

None of these functions are documented though, so I think the only way to understand what they do is to try them and see what effective set of VirtualFiles are returned.

TysonMN avatar Apr 08 '22 14:04 TysonMN

It does seem a bit inconsistent, doesn't it? I would have presumed it'll be consistent on the stage vs unstaged, at the very least.

While I'm very open to changing it, I'm wary of delving into specifics of the IDEA implemenation. The API has a long history of being both a bit odd and badly documented, and I'm very wary of trying to reverse engineer it, especially with regards to future behaviour.

As far as I can tell with a bit of poking around, Changes are the individual edits, so a very granular set that would have to be transformed into file-level changes. LocalChangeLists would just allow us to operate on the individual lists that are managed by the ChangeListManager, and hence I'd expect the same result.

getModifiedWithoutEditing seems like the only valid possibility, but frankly I've no idea quite what it does. My GoogleFu has failed me, and I'm not confident enough in my understanding of the impl to comment.

jshiell avatar Apr 10 '22 12:04 jshiell

I am willing to try/test all three methods, but I don't know how.

After I make each change, is it possible for me to locally create a new version of the plug-in that I can add as an extension to my IntelliJ?

TysonMN avatar Apr 10 '22 12:04 TysonMN

Oh yes, it's just a Gradle build, e.g.

./gradlew clean test xtest buildPlugin 

Drop the test bits if you just want to jam it in for experimentation, of course. That'll generate the plugin zip in build/distributions - which you can then install in IDEA using "install plugin from disk" in the plugin panel.

jshiell avatar Apr 10 '22 12:04 jshiell