-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #1076: Add support for palantir-java-format #1083
fix #1076: Add support for palantir-java-format #1083
Conversation
Both versions tested are compatible with java 8
It looks like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've gotta pick whether you're staying compatible with GJF or going your own way :)
lib/src/main/java/com/diffplug/spotless/java/PalantirJavaFormatStep.java
Outdated
Show resolved
Hide resolved
lib/src/main/java/com/diffplug/spotless/java/PalantirJavaFormatStep.java
Outdated
Show resolved
Hide resolved
lib/src/main/java/com/diffplug/spotless/java/PalantirJavaFormatStep.java
Outdated
Show resolved
Hide resolved
That's fair, I can remove the extra bits, and trim down the API :-) |
Support for non-default styles and alternative artifacts have been dropped in favor simplicity. If requested, we can add support for reflowing strings in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Thanks for the review! |
I'm gonna give this ~24hrs in case anyone else wants to weigh-in and then I'll merge and release. |
Welp, jcenter is down today (semi-scheduled), which has brought the Gradle plugin portal down. https://discuss.gradle.org/t/plugins-redirecting-to-jcenter/41909/4 This PR is confirmed to pass all tests before the Gradle outage, so I'm moving forward with merging. |
Released in |
What
palantir-java-format is a modern, lambda-friendly, 120 character Java formatter based on the excellent google-java-format, and benefits from the work of all the original authors. palantir-java-format is available under the same (Apache 2.0 License)[https://github.com/palantir/palantir-java-format/blob/develop/LICENSE].
Examples from the readme
(1) before:
(1) after:
(2) before:
(2) after:
How
This implementation is nearly identical to the google-java-format implementation, given that palantir-java-format is a fork! I've avoided coupling the implementations, as that's more likely to cause harm than help, especially given the logic around version checks for supported features.
One difference between the implementations is that I have opted not to support reflowing strings. Currently the palantir-java-format library does not expose the reflowing method as public API, so it would have to be implemented using a different method such as Formatter.formatSourceAndFixImports.
PR metadata
[Unreleased]
section of CHANGES.md, plugin-gradle/CHANGES.md, and plugin-maven/CHANGES.md which includes:[] a link to the issue you are resolving (for small changes)plugin-foo/CHANGES.md
for that plugin. If your change affects lib in an end-user-visible way (fixing a bug, updating a version) then you need to updateCHANGES.md
for both the lib and all build plugins. Users of a build plugin shouldn't have to refer to lib to see changes that affect them.