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

Martin Schwenke martin at meltin.net
Tue Apr 10 00:27:59 UTC 2018


Hi Simo,

On Mon, 09 Apr 2018 18:18:11 -0400, Simo <simo at samba.org> wrote:

> Attached find a new version that deals with python3 properly and
> also has better handling of indent, by spitting only a diff file with
> the propsed diff you should apply to pass it's rules.
> Previously the code was trying to line match and give a generic error
> with the line number but that doesn't work because indent can change
> lines by wrapping or unwrapping so the line numbers would make no sense
>  on longer files.

Looks good!  I notice that it doesn't exit with non-zero when it
(thinks that it) finds issues in my current branch.  Do we want it to
do that?  Would that be as simple as having warn() set a global?

> I have no yet addressed the space and parenthesized issues in this
> specific email simply because I ran out of time and I am not sure we
> actually do not want them.
> 
> I am open to changing these though if more people agree on the need for
> changing them.

I don't think that we should error on things that README.Coding doesn't
prohibit, particularly if they appear in "good" examples.  I think this
is particularly true if people are pushing hard for this code to be
used in tests to validate code.  It would be wrong to have tests that
contradict README.Coding.  We could, of course, change README.Coding if
there is a good reason to do so.

I hope that others agree...  :-)

I note that these particular checks seem to be implemented in
cstyle-file.py (via check_binary_operator() and
check_parenthesized_return()), so they should be easy to remove.

peace & happiness,
martin



More information about the samba-technical mailing list