[PATCH] Add utility to check for indentation in files or patches
simo at samba.org
Mon Apr 9 19:35:32 UTC 2018
On Mon, 2018-04-09 at 22:17 +1000, Martin Schwenke wrote:
> On Mon, 09 Apr 2018 07:51:56 -0400, Simo <simo at samba.org> wrote:
> > On Mon, 2018-04-09 at 20:48 +1000, Martin Schwenke wrote:
> > > 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 ...
> I didn't but I do now. Much better! Thanks! :-)
> A couple of things that we might not want:
> * No space before or after binary operator
> We have "good" examples in README.Coding without spaces around binary
> operators. For example, in a for-loop and in a calculation involving
> * Parenthesized return expression
> We don't have a rule against this.
> In all the simple cases, doing this is bad style. However, for a
> complex expression it might provide clarity.
> For example, in the same way that:
> x = (y.foo == z.bar);
> gains clarity from the parentheses, I think the following does too:
> return (y.foo == z.bar);
> Or, perhaps, the latter is against the guidelines because we should
> be doing:
> ok = (y.foo == z.bar);
> return ok;
> However, since we have access to y.foo and z.bar in a debugger, we
> can easily check what the return value will be, so I think the
> original is OK.
> Not sure... :-)
I am updating the code to work with python3 (the original catered for
python 2.6 ...) and I will add measures to deal with your feedback too,
although I have to say I think I may prefer to keep both rules above as
that's what indent also does ?
Otherwise I need to check how to suppress that in indent I guess.
But I'll look into it.
More information about the samba-technical