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

Martin Schwenke martin at meltin.net
Mon Apr 9 12:17:13 UTC 2018


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
  sizeof().

* 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...  :-)

peace & happiness,
martin



More information about the samba-technical mailing list