0

Is there a library or maven plugin how-to auto format JAVA code against a checkstyle configuration as pre commit hook and IDE. We are working in a team where some use IDEA IntelliJ and some VS Code. How can I make sure that once the code is pushed it has the same formatting rules applied. I googled some time but I cannot find a streamlined solution. Am I missing something?

emilio
  • 588
  • 3
  • 12
  • https://stackoverflow.com/questions/996646/stand-alone-java-code-formatter-beautifier-pretty-printer is related. But how about setting up relatively equivalent formatting rules in both ides and not format non-edited lines? Formatting per pre-commit-hook has its own problems.. – SpaceTrucker Jun 28 '22 at 08:31
  • As far as I can see there is [spotless](https://github.com/diffplug/spotless) which can use [google auto format](https://github.com/google/google-java-format) but I'm not sure this will solve the problem. I'll try it and see if I can get this setup running – emilio Jun 29 '22 at 11:51

0 Answers0