checkstyle-idea
checkstyle-idea copied to clipboard
"Check All Modified Files" checks staged added files but not unstaged added files
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
Video is created with CheckStyle version: 5.63.0
After looking at
- the code executed when the
Check All Modified Files
button is clicked as well as - the code executed when the
Check Files in the Current Change List
button is clicked (because this button also doesn't do what I want),
...the only possible alternative implementations that I see would involve
-
ChangeListManager.getModifiedWithoutEditing()
, which returnsList<VirtualFile>
; -
ChangeListManager.getChangeLists()
, which returnsList<LocalChangeList>
; or -
ChangeListManager.getAllChanges()
, which returnsCollection<Change>
.
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 VirtualFile
s are returned.
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, Change
s 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.
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?
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.