My team is developing Java code in a couple different IDEs, with differing numbers of columns. It's worked well so far, but we've been asked to deliver compilable code to a partner with the source limited to 80 columns. We'd like to do this as a professional courtesy, but we're not able/willing to work with 80-column limited code on a day to day basis. Are there any tools available that will take Java code, and intelligently add line breaks so that it fits within 80 characters and still compiles correctly? Ideally, I'd like it to be one more automated step in our build process, to go recursively through our source directory for .java files and produce a copy with the new formatting.
I'm not interested in the virtues of 80-column code or editors that do or don't word wrap, just in seeing whether there is a quick fix that will make everyone happy without anyone having to change the way they do things.
Intellij and eclipse and almost any IDE will do that. But...
Maybe you want to ask yourself if you want to automate that, even if you do that in an automated way, let's say maven, the code could be break up in a way it's harder to read than it was before, it can be breaking in the middle of an important line or method and you don't want that even if it compiles.
What we have done in the past is set a couple of .xml file with the settings of eclipse or intellij (they both allow you to export the settings), then with maven use the checkstyle plugin to enforce developers to have this settings; it will allow you to do it in a day by day basis always with a developer deciding when the code should break the line.
And lastly, maybe you want to use 100 or 120, they are the new 80.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With