Code formatting

Ian Springer ian.springer at redhat.com
Wed Apr 4 16:06:26 UTC 2012


That sounds good.

But one other important thing: If you decide to reformat an existing 
file that is not formatted according to the standard, do it in a 
separate formatting-only commit. Do not include it in the same commit as 
any significant code changes (e.g. a bug fix or an enhancement). The 
reason is that then it is very hard for people to review the diff for 
the significant code changes, because it is cluttered with reformatting 
changes. I think I noticed Stefan just checked in a change to the 
Eclipse settings file that causes Eclipse to only reformat changed 
lines, rather than the entire file, which is great (this is what 
IntelliJ does by default).

So please start formatting new code and changed code (changed lines only 
unless in a separate commit!) using the standards.

Whether we go back and reformat the entire code base and then start 
reformatting code upon check-in is a different topic that we can discuss 
some other time.

On 04/04/2012 10:53 AM, Charles Crouch wrote:
> I love a good "my code is more readable than your code" fight as much as the next man, and to be honest whitespace changes in commit diffs drive me wild.
> But I'm with mazz, I don't care what format we use as long as we're consistent.
>
> So can we REQUIRE Ian's suggestion:
>
>> Download this IntelliJ plugin
>> (http://plugins.intellij.net/plugin/?idea&id=6546) and point it at
>> these
>> two files:
>>
>> .settings/org.eclipse.jdt.core.prefs
>> .settings/org.eclipse.jdt.ui.prefs
> Stating the obvious, all Eclipse users should be using the above prefs files already.
>
> The above should address our Java code at least, right?
>
> How about going forward anyone that commits something that doesn't match the prefs defined in /.settings should be exposed to public ridicule on this list?
>
>
>
> ----- Original Message -----
>> On Wed, 2012-04-04 at 09:49 -0400, Stefan Negrea wrote:
>>> The typical Java coding standard has { at the end of the code line.
>> Right, which is why that is our standard today - that's the argument
>> that was given.
>>
>> Oh, also, I don't like engaging in code formatting threads anymore -
>> I
>> just go with the flow and do what people tell me to do :-) I gave up
>> the
>> ghost on arguing my viewpoint on code formatting - it seems I'm an
>> odd
>> ball and how I like code to be formatted is much different than the
>> vast
>> majority of people :-)
>>
>> _______________________________________________
>> rhq-devel mailing list
>> rhq-devel at lists.fedorahosted.org
>> https://fedorahosted.org/mailman/listinfo/rhq-devel
>>
> _______________________________________________
> rhq-devel mailing list
> rhq-devel at lists.fedorahosted.org
> https://fedorahosted.org/mailman/listinfo/rhq-devel


-- 
Ian Springer
Principal Software Developer
JBoss Operations Network
Red Hat
ian.springer at redhat.com



More information about the rhq-devel mailing list