Skip to content
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

Support Palantir-Java-Format for Java (500USD Bounty) #3448

Closed
lihaoyi opened this issue Sep 3, 2024 · 5 comments · Fixed by #3531
Closed

Support Palantir-Java-Format for Java (500USD Bounty) #3448

lihaoyi opened this issue Sep 3, 2024 · 5 comments · Fixed by #3531
Labels
Milestone

Comments

@lihaoyi
Copy link
Member

lihaoyi commented Sep 3, 2024


From the maintainer Li Haoyi: I'm putting a 500USD bounty on this issue, payable by bank transfer on a merged PR implementing this.


Palantir-Java-Format is a common Java autoformatter, and we should support it as a contrib/ module to better support Java projects. We should support all common configuration options to allow usage on JavaModules and ScalaModules (which can contain Java sources). It should broadly work the same way ScalaFmt works for Scala (https://mill-build.org/mill/0.11.12/Scala_Module_Config.html#_reformatting_your_code) This needs to come with a reasonable set of unit tests, docs, and at least one example test that can be included in the documentation.

May be able to adapt something from https://github.com/sbt/sbt-java-formatter

@lefou
Copy link
Member

lefou commented Sep 3, 2024

I'd prefer palantir, either directly or via spotless, which could provide a lot of other formatters too.

@lihaoyi
Copy link
Member Author

lihaoyi commented Sep 3, 2024

Sure! Maybe it should be via spotless then?

@lihaoyi lihaoyi changed the title Support Google-Java-Format (500USD Bounty) Support Spotless Formatter for Java (500USD Bounty) Sep 3, 2024
@lihaoyi lihaoyi changed the title Support Spotless Formatter for Java (500USD Bounty) Support Palantir-Java-Format for Java (500USD Bounty) Sep 3, 2024
@lefou lefou added the bounty label Sep 3, 2024
@lihaoyi
Copy link
Member Author

lihaoyi commented Sep 3, 2024

Let's go with palantir-java-format for now. At a glance Spotless seems a lot more heavyweight, and maybe can come in a follow up, but palantir-java-format should suit the immediate need of "we need a java formatter" and hopefully be easier to implement

@lefou
Copy link
Member

lefou commented Sep 3, 2024

I experiemented with it in the past but got some class access issues due to not using the module classloader. So, if you're a Scala dev not so deep into Java, expect some difficulties.

@lihaoyi
Copy link
Member Author

lihaoyi commented Sep 3, 2024

yeah I assume there'll be stumbling blocks but I assume they'll be work-around-able. If it can work in eclipse/intellij/gradle/spotless it should be doable inside Mill; worst come to worst we can run it in a separate subprocess. But that's for whoever picks up the bounty to figure out!

lihaoyi pushed a commit that referenced this issue Sep 22, 2024
Added `contrib.palantir.JavafmtModule` for formatting Java sources using
[Palantir](https://github.com/palantir/palantir-java-format/).
The plugin also supports command line arguments for
- checking for formatting errors with `--check` flag
- formatting specific files or folders

Resolves #3448.
@lefou lefou added this to the 0.12.0-RC3 milestone Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants