Cosium / git-code-format-maven-plugin

A maven plugin that automatically deploys code formatters as pre-commit git hook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Output the formatting issue

ngomichael opened this issue · 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!

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 :)