Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code style and conventions #3

Open
ethomson opened this issue May 14, 2013 · 2 comments
Open

Code style and conventions #3

ethomson opened this issue May 14, 2013 · 2 comments

Comments

@ethomson
Copy link
Owner

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:

  • A well defined set of whitespace / code formatting rules
  • Save actions that apply these rules (eg, run Source -> Format) as well as some other rules (cleanup imports and - at least on some projects - add final where appropriate).

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
Copy link
Contributor

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
Copy link
Owner Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants