anti-tab thing, Re: [Twisted-Python] Re: [Twisted-commits] r16495

Cory Dodt corydodt at twistedmatrix.com
Wed Mar 29 10:35:03 MST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

In case you've never encountered a pre-commit hook, here's a sample of the
effects:

  cory ~/wc/vellum% echo '        ' > foo.py
  cory ~/wc/vellum% svn add foo.py
  A         foo.py
  cory ~/wc/vellum% svn ci -m "i did not read the coding standard" foo.py
  Adding         foo.py
  Transmitting file data .svn: Commit failed (details follow):
  svn: 'pre-commit' hook failed with error output:
  Python file contains lines that begin with tabs: 'trunk/foo.py'
  There may be others as well.

If Twisted wanted to adopt this, I would suggest adding a link to the coding
standard in this message, or something.

C



Cory Dodt wrote:
> For general discussion, I have attached a pre-commit hook that rejects commits
> of .py files containing leading tabs on any line.  It does not do anything to
> files not ending in .py.  It does check for tabs mixed with spaces.  It
> ignores tabs occurring anywhere but the leading whitespace.  Here's the regex:
> 
> _tabs = re.compile(r'^\s*\t\s*.*$')
> 
> I have used this, albeit lightly.
> 
> C
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEKsVH3A5SrXAiHQcRAgwkAJoDMNtUGzCt7An+vkv9JjhwEC88bACbB0Ys
X7LTPtokm3F/GYZsgi5+2Es=
=vuCz
-----END PGP SIGNATURE-----




More information about the Twisted-Python mailing list