Max mtg wrote:Hi,
I've just updated my code the latest version from the repository. I'm always wondering what others have done and learn that by comparing newcoming versions with old working copies I had. Once there are a few lines of diffs - it's quite easy to understand, but it's much-much harder when you see the whole file coloured because the one who commited the file applied autoformatting to it.
Especially I refer to this case:
- Code: Select all
http://svn.slightlymagic.net/websvn/comp.php?compare[]=%2Ftrunk%2Fsrc%2Fmain%2Fjava%2Fforge%2Fcard%2FcardFactory%2FCardFactoryUtil.java%409782&compare[]=%2Ftrunk%2Fsrc%2Fmain%2Fjava%2Fforge%2Fcard%2FcardFactory%2FCardFactoryUtil.java%409748
Can anyone see which changes are relevant to committed patch-note and which are due to autoformatter tool?

click
Ignore Whitespace in the upper right.
typically, it is a good idea to ignore changes in the
amounts of whitespace in all code comparisons. for example, if you use the command line, use {diff -b} and {svn diff -x -b}. if you don't, you have to find the setting in your diff gui. ignoring all whitespace is second best.
there are
other problems with WebSVN at present. you can use Subclipse or another
Subversion tool to view better diff output.
if you use Eclipse with the Checkstyle plugin, it will issue errors for all style violations for each .java and .properties file you have open. do you have the instructions from the wiki with the table of recommended plugins for Eclipse?
Max mtg wrote:What I would like to suggest - accept a coding convention (if there is none yet) and set up all the autoformatting tools across all developers' systems to produce code styled in the same way. This way, I hope, we'll avoid similiar problems in future.
we use Checkstyle as the coding convention. also, i think the project-specific Eclipse formatting standards already enforce

no tabs,

proper left curly brace placement, and

no wildcard star imports. for

, press {Ctrl+Shift+O} {that's a letter "Oh"} to organize all of the imports in the current file you're editing.
many files have violations. we fix them slowly. personally, i try to address at least some Checkstyle, FindBugs, and PMD messages in files where i have changed a significant amount of code. these are the files i will also be testing the most rigorously before committing.
but Forge is somewhat fragile, so there is often danger in changing too much, even if it seems innocuous. once I changed a (new Integer(x)) to an int, because Java 5 does automatic casts between these types. it compiled fine, but it broke the GUI. i still do not understand why. it was very strange.