[Ovirt-devel] Re: a pox on whitespace

Hugh O. Brock hbrock at redhat.com
Thu Jul 17 15:49:10 UTC 2008


On Wed, Jul 16, 2008 at 07:21:46PM +0200, Jim Meyering wrote:
> Here are some things we can do to avoid
> bad whitespace (not just trailing whitespace)
> without causing too much development pain:
> 
> server-side enforcement
>   have a git pre-push hook check for and reject changes that
>   add trailing blanks.  This typically cannot be circumvented.
>   However, I've set up similar things whereby exceptional cases
>   can be white-listed.

I'd be in favor of putting this into place immediately.
 
> local-commit-enforcement
>   With recent git, just do this in each of your
>   working directories:  chmod a+x .git/hooks/pre-commit
>   and a commit that would have added bad whitespace will fail.
>   (you can circumvent it with git commit's --no-verify (-n) option)

And this... how recent a git version?

> "make check"-style detection
>   Add a top-level Makefile rule that fails if any file
>   contains bad whitespace.  Then establish policy that one must
>   pass "make check"s tests before committing/pushing.

This is probably less compelling for us since we don't really compile
the app (although I habitually still run make and then install the RPM
to test changes).

> editor highlighting
>   Enable syntax highlighting in your editor and tell it to
>   display bad whitespace.  For example, add this to your ~/.vimrc:
> 
>     let c_space_errors=1
>     highlight RedundantSpaces ctermbg=red guibg=red
>     match RedundantSpaces /\s\+$\| \+\ze\t/
> 
> For emacs, you might want to try show-wspace.el (I haven't,
> but it's the first google hit for "highlight whitespace emacs")
> <http://www.emacswiki.org/cgi-bin/wiki/show-wspace.el>, or maybe
> you already use font-lock mode, which you can customize.

This is voluntary I guess but seems like a good thing for developers
to do.

Also needed might be a quick script to remove trailing whitespace from
a file?

Thanks for this,
--Hugh




More information about the ovirt-devel mailing list