Rice, Kevin (Contractor) wrote on Fri, May 10, 2013 at 15:48:38 +0000: > [[[ > Add contrib/hook-scripts/precommit-pyfiles-notabs-properties.py > > Functions as a pre-commit hook script that does several things: > * prevents committing any python file containing a tab character > * checks if there are tabs in the source file and warns if so > * aborts if incorrect properties of eol-style and keywords 'id' > ]]] >
Thanks for the patch. I'm not sure if this is sufficiently generic for inclusion in contrib/ (especially given that we deprecate that directory), but I'll note a few points anyway: > > This message, including any attachments, is the property of Sears ... > without reading the contents. Thank you. Please nuke these footers when emailing public mailing lists. Content-Description: contrib.precommit.pyfiles.patch.txt > Index: contrib/hook-scripts/precommit-pyfiles-notabs-properties.py > =================================================================== > --- contrib/hook-scripts/precommit-pyfiles-notabs-properties.py > (revision 0) > +++ contrib/hook-scripts/precommit-pyfiles-notabs-properties.py > (working copy) > @@ -0,0 +1,127 @@ > +#!/bin/env python > + Please specify a license. Also, the conventional #! line uses '/usr/bin/env', not '/bin/env'. In fact, the latter does not exist on either FreeBSD or Linux. > +def command_output(cmd): > + " Capture a command's standard output. " > + import subprocess > + return subprocess.Popen( > + cmd.split(), stdout=subprocess.PIPE).communicate()[0] This will not DTRT if you have filenames that contain spaces or children of the root with names that start with a hyphen. That should be fixed (preferred) or documented.