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

Simo simo at samba.org
Mon Apr 9 11:55:38 UTC 2018


On Mon, 2018-04-09 at 11:44 +1200, Andrew Bartlett wrote:
> On Sun, 2018-04-08 at 13:02 -0400, Simo via samba-technical wrote:
> > Hi all,
> > 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.
> 
> script/ would be a better location, python/ is for python libraries. 1

For some reason I thought we do not have a top level script/ ...

> > 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
> > 
> > The style violations are output per file with the line and kind of
> > violation.
> > 
> > You can style check a whole file this way:
> > $ python ./python/cstyle-file.py $FILENAME
> > Or:
> > $ cat $FILENAME | python ./python/cstyle-file.py
> > 
> > 
> > Try to check the last 100 commits for an idea of what violations are
> > found.
> 
> Thanks Simo, I appreciate you taking the effort to help bring us to a
> soution here.  
> 
> Is there a way to whitelist/blacklist file types and directories with
> this tool?

The original tool was looking exclusively under src/ what do you think
if I exclude all third-party/ and source4/heimdal* ?

> We really don't want commits bouncing because they import a new heimdal
> or update third_party for example, and it would be helpful to be able
> to exclude some files both temporarily when (for example) moving old
> code around.

I think we may need a way to push through commits anyway, but we can
definitely improve the tool until it is 90% useful, and then handle
cases as they come by.

Simo.



More information about the samba-technical mailing list