spotless icon indicating copy to clipboard operation
spotless copied to clipboard

Handling of SortPom

Open Ekryd opened this issue 1 year ago • 4 comments

Hi! I'm the author of SortPom and I just realised that you are using my plugin for sorting the pom file. This is Great! Can I contribute to the integration with Spotless somehow?

More concretely, should SortPom react to any settings that Spotless has, such as encoding or line endings? Or add support for endWithNewline?

Ekryd avatar Jan 16 '24 11:01 Ekryd

PRs welcome :)

Goooler avatar Jan 16 '24 12:01 Goooler

Anything special on your wish-list?

Ekryd avatar Jan 18 '24 19:01 Ekryd

should SortPom react to any settings that Spotless has, such as encoding or line endings? Or add support for endWithNewline?

The Spotless value proposition is "if you implement a String -> String function, we will handle the rest" (contributing.md). We handle

  • line endings
  • encoding
  • fix idempotence problems
  • combine one function (e.g. sortPom) with other functions (e.g. endWithNewline)

So you don't need to respond to any of our settings. We, however, are obliged to respond to your settings, and this is how we model them:

  • https://github.com/diffplug/spotless/blob/main/lib/src/main/java/com/diffplug/spotless/pom/SortPomCfg.java
  • https://github.com/diffplug/spotless/blob/main/lib/src/sortPom/java/com/diffplug/spotless/glue/pom/SortPomFormatterFunc.java

If there's anything missing, feel free to add it :)

nedtwigg avatar Jan 23 '24 04:01 nedtwigg

I have updated the SortPom plugin with support for endWithNewline; whether to ensure that sorted pom ends with a newline or not.

I have created a PR in spotless for that version bump: https://github.com/diffplug/spotless/pull/2049 Hope that it can be of some use 😊

Ekryd avatar Feb 20 '24 09:02 Ekryd

PR is merged now, all seems fine. Thanks for your great job around Spotless!! 👋

Ekryd avatar Mar 09 '24 11:03 Ekryd