Pyflakes pre-commit hook in subversion

mobiledreamers at gmail.com mobiledreamers at gmail.com
Tue Jan 8 20:02:28 EST 2008


http://tarekziade.wordpress.com/2006/11/01/protecting-a-python-svn-code-base-with-the-pre-commit-hook/

Is it possible to check code in python before committing to svn

using pyflakes, pythontidy

*Pyflakes and Subversion*

Pyflakes <http://www.divmod.org/projects/pyflakes> is a nice little utility
that checks your Python code for errors. The main advantage over PyChecker
and PyLint is that it is much faster and gives almost no false positives.
Today I wrote a little hack on top of the
enforcer<http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/enforcer/enforcer>pre-commit
script which forces the code you check in to pass pyflakes. Eg,
the users of svn will see the following output if they try to check in code
which has errors pyflakes can detect:

$ svn ci -m "fix" completion.py
Sending        completion.py
Transmitting file data .svn: Commit failed (details follow):
svn: 'pre-commit' hook failed with error output:
Pyflakes found 1 error(s)/warning(s):
kiwi/trunk/examples/completion.py:1: undefined name 'test'

The small "configuration" file for enforce can be found
here<http://www.async.com.br/~jdahlin/misc/enforcer.conf>.

Can you share enforcer file? or a means to ensure safe code in python repo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080108/28146403/attachment.html>


More information about the Python-list mailing list