Re: [PATCH v2 1/7] remote.c: add braces in anticipation of a follow-up change
- From
Stefan Beller <sbeller@google.com>
- Date
- Oct 26, 2018, 21:05 UTC
- Message-ID
- <CAGZ79kYTHx6vz_YTCLBTBnoxPEV0sCa+Q46OmMVxuY09Dm1Skw@mail.gmail.com>
- In-Reply-To
- <20181026192734.9609-2-avarab@gmail.com>
On Fri, Oct 26, 2018 at 12:27 PM Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
Show 5 quoted lines
> > The CodingGuidelines say "When there are multiple arms to a > conditional and some of them require braces, enclose even a single > line block in braces for consistency.". Fix the code in > match_explicit() to conform.
A tangent from a bystander:
This sounds like a lovely transformation that we'd want to apply to the whole tree (Who wouldn't want to conform to our self-imposed coding guidelines?), so I tried coming up with a coccinelle patch to do that, but I did not manage to produce such a patch, yet. So far I am at
@@
expression E1;
statement S1, S2;
@@
{<...
if (E1) {
S1;
-} else
+} else {
S2;
+}
...>}but this doesn't transform the simple test program that I wrote.
> While I'm at it change the if/else if/else in guess_ref() to use > braces. This is not currently needed, but a follow-up change will add > a new multi-line condition to that logic.
The patch looks good.
Stefan