Git Product home page Git Product logo

Comments (3)

ctubbsii avatar ctubbsii commented on June 16, 2024

The plugin can only verify whether the formatter plugin would have changed a file if it had been used to perform the formatting. It doesn't know which lines are the problem. It just signals you need to run the formatting task. If you use the plugin to format the file that caused the error, then you can easily perform a diff on the two files to see where the problem was. Reporting the specific line numbers and comparing formatted and unformatted files to do so is outside the scope of this plugin.

from formatter-maven-plugin.

dmak avatar dmak commented on June 16, 2024

I think you find a right direction: when making a comparison, generate a unified diff, which will include an indication where the diff starts and thus makes further analysis faster. Is it difficult to add this functionality?

Generate formatted diff output in Java

from formatter-maven-plugin.

ctubbsii avatar ctubbsii commented on June 16, 2024

@dmak It's not necessarily difficult. It's just a lot of extra code, and a lot to consider when trying to provide options to display the output. If we do this, then some people will want to suppress it, so we'll have to have options for doing that, and some people might want the files written but save the old files as backup, etc. Doing this just adds bloat, and possibly degrade performance.

Ultimately, none of it is necessary, since you can just run the formatter:format goal and see the diff yourself. If you're doing it in a GitHub Action, you can run formatter:validate as a goal, then conditionally on failure, run formatter:format and git diff. So, it's trivial to see the differences already without any changes in the plugin.

from formatter-maven-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.