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

Simo simo at samba.org
Mon Apr 9 12:23:39 UTC 2018


On Mon, 2018-04-09 at 07:51 -0400, Simo via samba-technical wrote:
> On Mon, 2018-04-09 at 20:48 +1000, Martin Schwenke wrote:
> > 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?
> 
> Do you have 'indent' installed ?
> I probably need to catch the exception better, I changed this part from
> the original stuff, as it was using emacs ...

It won't work right regardless, sorry, fixing and adding other feedback
, will post followup soon.

Simo.



More information about the samba-technical mailing list