On 11/11/11 2:30 PM, Aliaksandr Autayeu wrote:
Dear all,
I'm a little confused after having searched docs and wiki and having found
nothing about project line-endings and code style. During patch submission
and following merges that probably I'm not doing something right, probably
didn't adopt the project styles :) Please, can you help with the following
questions:
1) What is the official line-ending style for project code source? That is,
win? unix?
We are using subversions svn:eol-style native property, which will ensure
that you always get the native styles when you check out. We just recently
fixed that and set this property on all files in the opennlp folder, sandbox
and website is still missing, patch would be welcome.
2) Which eol settings are important in version control systems? That is,
convert\leave in SVN, Git, ...
I believe Git doesn't get the eol-style property from subversion, I think
on of the apache git pages mentioned that. Maybe that is why your patches
often remove/add entire files, even if only a couple of lines have been
changed.
3) Is code style (and formatting rules) documented somewhere? That is -
comments, bracing, line wrapping, line length... I have found that on some
points (for example I prefer forced braces on if and for statements,
because this helps avoiding certain bugs) there is divergence and least I'd
like to do is to adopt project style.
We don't yet have a code style guideline, people tend to disagree on smaller
formatting things, e.g. place else on the same line or new line, if
statement
only with braces or for one-statement ifs only without, etc.
In my opinion that is not so important, but important is that people not
always change everything to their personal flavor. They should write
new code in their style but converting existing code just makes things
difficult
to diff and code changes hard to review.
What we usually do is that we use 2 spaces to indent, instead of tabs
and the max line length is somewhere between 80 and 100. Maybe we
should make it 100.
You are welcome to help us writing down some rules, I believe it should be
mostly sun guidelines with a very few exceptions.
Maybe like the UIMA ones?
http://uima.apache.org/codeConventions.html
I think that would be a good fit for our source code.
You can also send us patches for the website, but that seems not be
in git. Just had a quick look over at Github.
Jörn