People often find google's restriction on 100 chars max length pretty annoying.
Google java format library allows max length size modification quite easy. It would be good to expose this as an additional optional task property.
If approved, can be done pretty easily.
I'd be happy to merge a PR for this.
After further looking into codebase I must admit I was too optimistic. Changing maxLineLength without byte modifications is at least challenging. And spotless's lib subproject does not allow adding new dependencies to try a bytes modifications approach.
There is a PR to google to allow this parameter change, but looks like it will never be merged:
https://github.com/google/google-java-format/pull/57
Do we want to have this feature added via byte modifications? Or it is too complicated/dangerous?
spotless's lib subproject does not allow adding new dependencies to try a bytes modifications approach.
That is what lib-extra is for.
Do we want to have this feature added via byte modifications? Or it is too complicated/dangerous?
We're zealous about keeping Spotless' core simple, and we're also zealous about keeping the user experience simple. We are hands-off when it comes to allow contributors to jump through crazy hoops to add a new step. @fvgh implemented a whole subset of the OSGi runtime just to get eclipse-based formatters to work outside of eclipse, and @simschla got npm to download and run formatters on behalf of spotless.
Given that we can currently handle google-java-format with no outside dependencies, I don't want to lose that simplicity. However, if we had another version of google-java-format-patched which could do things that google-java-format couldn't by byte-patching, I'd be okay with that if we're able to do it in a way that is easy for users to use, and if there was good documentation for how future contributors can update the patching for future versions of google-java-format.
However, I seriously doubt this really ought to be anyone's top priority item to work on ;-) Maybe use the eclipse formatter with google-java-format settings, but with the line-length disabled?
yeah, everything makes total sense.
Just further thinking:
To achieve what i want basically i need either:
I'd think it would take less time to maintain a fork of google-java-format and publish it to mavencentral. elgoog-java-format - the formatter for rebels who won't take no for an answer on their PRs ;-) Very easy to then use it with the existing Spotless step (or other google-java-format plugins out in the wild).
I'm gonna go ahead and be the guy that says "Yes please". I want more than 100 chars per line!
I'm closing as "unlikely to be implemented". Still happy to take a PR if someone figured out how.
Most helpful comment
I'd think it would take less time to maintain a fork of
google-java-formatand publish it to mavencentral.elgoog-java-format- the formatter for rebels who won't take no for an answer on their PRs ;-) Very easy to then use it with the existing Spotless step (or other google-java-format plugins out in the wild).