[PATCH] Add utility to check for indentation in files or patches

Martin Schwenke martin at meltin.net
Mon Apr 9 10:48:58 UTC 2018


On Sun, 08 Apr 2018 13:02:10 -0400, Simo via samba-technical
<samba-technical at lists.samba.org> wrote:

> given recent discussions I finally took some time to do what I wanted
> to do for a long time.
> 
> This utilities, which I've simply stolen and adapted from MIT krb5, can
> be used in commit hooks or individually to check for style issues in
> commits or files.
> I do not know if putting them under python/ is right, you (reviewer)
> tell me.
> 
> Run:
> $ python ./python/cstyle.py 
> 
> Your latest commit or your current uncommitted code is checked.
> 
> Pass in a revision or a revision range and specific commits can be
> checked at once:
> Example:
> $ python ./python/cstyle.py HEAD~10..HEAD

Sorry, this doesn't work for me:

$ python ./python/cstyle.py HEAD~10..HEAD
649d1837061 ctdb-daemon: Add testing environment variable CTDB_LOCAL_DAEMON_MODE
Traceback (most recent call last):
  File "python/cstyle-file.py", line 312, in <module>
    check_file(lines)
  File "python/cstyle-file.py", line 244, in check_file
    indented_lines = reindent(lines)
  File "python/cstyle-file.py", line 65, in reindent
    p = Popen(args, stdout=PIPE, stderr=PIPE)
  File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

It just seems to blow up on some commits with a traceback.  Can someone
please explain what I'm doing wrong?

peace & happiness,
martin



More information about the samba-technical mailing list