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

Andrew Bartlett abartlet at samba.org
Sun Apr 8 23:44:42 UTC 2018

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

> 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?

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.


Andrew Bartlett

Andrew Bartlett
Authentication Developer, Samba Team         https://samba.org
Samba Development and Support, Catalyst IT   

More information about the samba-technical mailing list