git-code-format-maven-plugin icon indicating copy to clipboard operation
git-code-format-maven-plugin copied to clipboard

Output the formatting issue

Open ngomichael opened this issue 5 years ago • 1 comments

Hey,

I was wondering if there is a way for the plugin to output the formatting issue with the file. Currently, it outputs ExampleClass.java is not correctly formatted ! which only tells me that there is an issue with the formatting, not specifying why or which part of the code is causing the failure. I don't see anything in the documentation that can let me add to the output what the specific formatting rule the file isn't following (and what line in the file).

Is it possible to achieve what I want using this plugin? If this isn't possible, can/will you add this functionality to the plugin?

Thanks!

ngomichael avatar Apr 20 '20 19:04 ngomichael

Hi,

That would be a nice feature.

There is currently nothing allowing to do that. Also https://github.com/google/google-java-format does not provide a straight way of doing that.

IMO, we would need to call https://github.com/google/google-java-format/blob/4ddb9148c103b9c65768e519884b0c8ad5caaf39/core/src/main/java/com/google/googlejavaformat/java/Formatter.java#L278 and interpret its output.

Since it is not a priority for me, I hope you or somebody else will contribute with a pull request :)

reda-alaoui avatar Apr 20 '20 20:04 reda-alaoui