[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: John Peacock <john.peacock_at_havurah-software.org>
Date: Fri, 22 Aug 2008 06:12:31 -0400

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.

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. you
won't be able to tell who added a feature. If this is acceptable, you 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".


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 12:13:02 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.