spotless icon indicating copy to clipboard operation
spotless copied to clipboard

Extend IdeHook to support passing in multiple files

Open Bendzae opened this issue 1 month ago • 0 comments

Summary

A backwards compatible extension of the IdeHook fuctionality that allow passing in multiple file paths in a comma separated list:

./gradlew spotlessApply -PspotlessIdeHook=path/to/file_a.md,path/to/file_b.md

What does this solve?

Our specific use-case is to allow efficient invocation in a pre-commit hook. This way we can simply pass in a list of staged files and fix them in a single call.

I can imagine this might also be useful for plugin development.

Changes

  • Adjusted the IdeHook.java including it's State class to enable handling multiple files
  • Added new testcases to verify the behaviour

Notes

  • I decided to just not support the std in/out flag for multiple files to make it simpler

Review

Please let me know if you are missing anything in my PR/Description as its my first contribution to this repo! 🙂

Bendzae avatar Nov 28 '25 13:11 Bendzae