[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 17:05:26 -0500

On 8/22/08, Kevin Grover <kevin_at_kevingrover.net> wrote:
>
> On Fri, Aug 22, 2008 at 3:02 AM, Tom Browder <tom.browder_at_gmail.com> wrote:
>
> >
> > I think this has been discussed before, but I would appreciate any
> > ideas on how to minimize formatting changes from multiple developers
> > using different operating systems and different editors (and
> > settings).
...
> I would reformat all code upfront, in one step, and commit it with a comment
> along the lines of "Reformated with 'codeformat ARGS and OPTIONS'". If
> people reformat as they change things, it becomes impossible to tell what
> really changed. E.g. the actual code changed get eclipsed by the
> reformatting changes.

Good idea
.
> For day-to-day development, you can either _encourage_ developers to use the
> correct style in the future: this will be mostly automatic if your tools
> (editor) format the way you want.

That's been the problem--no control over editor settings, and folks
who have auto wrapping line editors that don't care about line
lengths. Yuch!

> And/or, you can add a pre-commit hook script that looks at each file in a
> commit: for each type to which your coding standards apply (i.e. source
...
> the same, the script dies with an error string "Source file XXXX is not in
> the correct coding style:" (you could also append the diff text from the
> compare). If you have a tool that just checks for coding style, you can
> also use that and die if it complains.
...

> The second approach can be a little draconian.

Yeah, but I bet it gets the attention of those with rogue editors.

> As an FYI, another nice reformatter is astyle (Artistic Style). I like it
> because it's standalone, configurable, and runs everywhere.

That's the one I'm thinking of, too. It sure should help us
cross-platform teams.

Thanks, Kevin.

-Tom

---------------------------------------------------------------------
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-23 00:05:47 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.