Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Reformatting of code

I should have checked our policy before making suggestions :)

The very first rule of our CDT policy states: 
        "It is recommended to preserve formatting and style of old code when making patches"
https://wiki.eclipse.org/CDT/policy

This rule has been part of our policy for 8 years, since the very creation of that wiki page 
in June 2008 (I'm not the one that wrote that rule).

I spent hours fighting with reformatting yet again this week, and I know I'm not the only one that
got affected.  I believe the reformatting was done by mistake and we just got unlucky.  So it is
worth reminding people to be careful about this and to follow our policy.

Thanks

Marc

________________________________
From: cdt-dev-bounces@xxxxxxxxxxx<mailto:cdt-dev-bounces@xxxxxxxxxxx> [cdt-dev-bounces@xxxxxxxxxxx<mailto:cdt-dev-bounces@xxxxxxxxxxx>] on behalf of Marc Khouzam [marc.khouzam@xxxxxxxxxxxx<mailto:marc.khouzam@xxxxxxxxxxxx>]
Sent: March 15, 2016 11:35 AM
To: CDT General developers list.
Subject: Re: [cdt-dev] Reformatting of code

Here's a better idea.
The "format on save" setting has an option to only reformat edited lines.  That sounds like the right way to go.  That will make sure your changes are right, but not affect the rest.  For other project than CDT that do follow the fomatting all the time, there is no need to reformat the entire file since it will already be properly formatted.

________________________________
From: cdt-dev-bounces@xxxxxxxxxxx<mailto:cdt-dev-bounces@xxxxxxxxxxx> [cdt-dev-bounces@xxxxxxxxxxx<mailto:cdt-dev-bounces@xxxxxxxxxxx>] on behalf of Marc Khouzam [marc.khouzam@xxxxxxxxxxxx<mailto:marc.khouzam@xxxxxxxxxxxx>]
Sent: March 15, 2016 11:30 AM
To: CDT General developers list.
Subject: Re: [cdt-dev] Reformatting of code

I realize it is easier to have standard way of working.  But in the end that reduces once person's efforts by pushing them on to others.

I'm willing to compromise with proposal #2 which is to reformat in a separate commit.  It will take an extra 2 minutes to do, but will save much more for the person coming after.

And BTW, turning off the auto-reformat on save, is a lot easier than spending an hour merging code.  You could even write an EASE script to add a button to toggle the reformatter (if that doesn't exist already).

________________________________
From: cdt-dev-bounces@xxxxxxxxxxx<mailto:cdt-dev-bounces@xxxxxxxxxxx> [cdt-dev-bounces@xxxxxxxxxxx<mailto:cdt-dev-bounces@xxxxxxxxxxx>] on behalf of Doug Schaefer [cdtdoug@xxxxxxxxx<mailto:cdtdoug@xxxxxxxxx>]
Sent: March 15, 2016 11:13 AM
To: CDT General developers list.
Subject: Re: [cdt-dev] Reformatting of code

I work on several projects. CDT is only one of them. I'd prefer not to have per project requirements for this. It's too hard to keep straight.

I also have format on save turned on to make sure I format all the code I touch. I recommend everyone do the same and use the default Java formatter. Then this will be less of an issue over time as we get all or code formatted the same.

Doug.

On Tue, Mar 15, 2016 at 10:13 AM, Marc Khouzam <marc.khouzam@xxxxxxxxxxxx<mailto:marc.khouzam@xxxxxxxxxxxx>> wrote:
Hello,

I would like to suggest a procedure when reformatting entire java files for CDT.

Personally, I use the git history very much, so reformatting has an impact on that.
Merging local changes can also become quite painful.
I recently spent over an hour merging a local change into a file that had been
fully reformatted. This does not feel like time well-spent.  And it's not enjoyable either.

I suggest that either:
1- we simply avoid reformatting
or
2- if justified, any file reformatting be done in its own commit

Thoughts?

Marc



_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx<mailto:cdt-dev@xxxxxxxxxxx>
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top