ethomson / jagged

java bindings to libgit2
MIT License
111 stars 29 forks source link

Code style and conventions #3

Open ethomson opened 11 years ago

ethomson commented 11 years ago

The initial stuff that's here is following the coding conventions that we use at Microsoft for Java code. (Even writing this is really amusing.)

Although now that I look at my setup closer, I don't have this enabled on one of my machines. So it's possible that the code style is half MS code style and half Eclipse default.

On previous projects, we have adopted a standard code style and enforced it rigorously, in order to prevent needless churn from things like whitespace changes or brace changes. We use:

This has been great for us.

But then, I'm an Eclipse user (and work on a team with all Eclipse users.) If other people are using IntelliJ or NetBeans or what not, this may not be as helpful. Do you have thoughts on this?

ludovicc commented 11 years ago

I don't know much about code formatters anymore. Jalopy is as good as dead, and JIndent is commercial.

It's possible to launch the Eclipse code formatter from the command line: http://www.peterfriese.de/formatting-your-code-using-the-eclipse-code-formatter/ so if you provide your settings, you can always mandate commiters to reformat their code with this tool. Even if they don't use Eclipse as their primary IDE, it's easy to install and should not block any good developer.

ethomson commented 11 years ago

I seem to remember that the maven eclipse plugin will allow you to write per-project metadata, and you can embed the code conventions in there. I'll give that a shot in the future and if you (or anybody, of course) wants to tell me that my code conventions are ugly, then we can go from there!