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

Show diff when has not been previously formatted is reported #937

Open
sebthom opened this issue Sep 7, 2024 · 1 comment
Open

Show diff when has not been previously formatted is reported #937

sebthom opened this issue Sep 7, 2024 · 1 comment

Comments

@sebthom
Copy link

sebthom commented Sep 7, 2024

Is your feature request related to a problem? Please describe.

First thanks for this great maven plugin! I have a project where the builds break with

org.apache.maven.plugin.MojoFailureException: File '.../xyz.java' has not been previously formatted. Please format file (for example by invoking `mvn net.revelc.code.formatter:formatter-maven-plugin:2.24.1:format`) and commit before running validation!

However I formatted the source code using the same config with the formatter plugin. So I have no idea what is going wrong.

Describe the solution you'd like
Please add an option to output a diff between the supposedly unformatted file and what the formatter thinks the formatted file should look like. This can help tracking down the underlying issue, may it be a bug in the formatter, with the line encoding, etc.

E.g. using https://github.com/java-diff-utils/java-diff-utils

So we get something like this https://github.com/diffplug/spotless?tab=readme-ov-file#%EF%B8%8F-spotless-for-maven

@hazendaz
Copy link
Member

Hi @sebthom, is this something you would be willing to provide support for here? It would happen quicker if you could contribute such an update.

As to the issue you are facing, can you provide a small reproducible project that shows this behavior so we can easily take a look to see. Add instructions to it on how you ran it to confirm.

Also keep in mind, add version you used here, platform you are on, etc. Anything that can help with diagnosing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants