andybalaam / rabbit-escape

Android and PC game inspired by Lemmings and Pingus
http://artificialworlds.net/rabbit-escape
GNU General Public License v2.0
76 stars 46 forks source link

`make format` target that formats all code #357

Open andybalaam opened 8 years ago

andybalaam commented 8 years ago

It is possible to run Eclipse's code formatter from the command line*.

* although I think only in a graphical environment

Eclipse's formatter is surprisingly effective and comprehensive - better than IDEA's (for my preferred style anyway) and better than anything else I've seen. If anyone knows better, please let me know because I'd much rather avoid depending on Eclipse.

So, make a Make target that formats all the Java code in the project (including Android code) in our preferred style.

Also, write instructions for IDEA and Android Studio to allow them to use the Eclipse Code Formatter plugin to share the same coding style.

If it didn't require a dependency on Eclipse, but something easier, I'd say it was mandatory to run this before committing, or even during every compile.

colonelfazackerley commented 8 years ago

Sometimes it's nice to put some extra spaces in to get something to line up.

I guess we need to decide if it's worth trading this in for more uniformity.

colonelfazackerley commented 8 years ago

Aha. Tags can be used to turn off the formatter in certain regions.

http://stackoverflow.com/questions/5115088/turn-off-eclipse-formatter-for-selected-code-area

andybalaam commented 8 years ago

Yes, that's the nuclear option, and we can also adjust the format to allow things we like.

andybalaam commented 8 years ago

Artistic Style looks like it might do what we need.

andybalaam commented 8 years ago

I am considering starting a small project called Kevlin that runs a code formatter that formats code as Kevlin would have it.