[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Enforcing Code Style

From: Tom Browder <tom.browder_at_gmail.com>
Date: Fri, 22 Aug 2008 06:14:18 -0500

On Fri, Aug 22, 2008 at 5:12 AM, John Peacock
<john.peacock_at_havurah-software.org> wrote:
> Tom Browder wrote:
>> I am thinking of periodically running a script that filters all source
>> and header files (C++) through a beautifier like bcpp.
> You could do this manually, but not in a hook (automatic). What you /may/
> want to do is investigate whether your beautifier supports commandline
> operation where it set the exit value to non-zero value (but doesn't
> actually change the file) iff it detected reformatting was required. Then
> you could use this in a pre-commit script to verify that the code meets your
> formatting requirements.

That sounds like a good idea. Am I correct that the script would have
to be run on the user's host?

> IMPORTANT NOTE: however you do this, you will wind up performing at least
> some "whitespace only commits" which will mess up your "blame" history (i.e.

Couldn't svn diff be defined on the user side to ignore
white-space-only changes?

Couldn't the script inject a comment somehow?

> you won't be able to tell who added a feature. If this is acceptable, you

I don't understand why.

> may want to mandate that when a developer opens a file that hasn't already
> been reformatted, they should perform the reformat *and nothing else* and
> commit those changes. If you mix reformatting with other code changes, you
> are going to be horribly confused.
> The issue of code formatting is pretty close to a religious debate, so I
> hope you are prepared for the inevitable pushback from the "old timers".

I know what you mean--and I'm an old timer.

Thanks, John, for your thoughts and help. And pardon my ignorance of
subversion scripting.


To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-08-22 13:14:44 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.