[Gluster-infra] [Bug 1564149] Agree upon a coding standard, and automate check for this in smoke

bugzilla at redhat.com bugzilla at redhat.com
Wed Apr 18 06:13:43 UTC 2018


--- Comment #15 from Xavi Hernandez <jahernan at redhat.com> ---
(In reply to Jeff Darcy from comment #13)
> IndentCaseLabels: personally I don't like indenting case labels because they
> create a gap with no close brace - unless people put braces around cases,
> which is a bad habit for other reasons - but I know I'm probably outvoted on
> that one.

The reason I proposed it is because if we don't indent labels, we have a brace
after 'switch' which is not followed by indentation, as it normally happens,
but we'll still have indentation of the code inside the case label without
braces (I also don't like the braces inside cases):

    switch (select) {
    case VALUE1:

(Visually, the closing brace seems to come from 'case' and not from 'switch')

I think it's visually simpler to indent the cases to make it clear they belong
to the switch case. This way it's easy to see where the switch starts and ends.

    switch (select) {
        case VALUE1:

Note that with the reduction of tabs from 8 to 4, the code is at the same
indentation, so the gap with the closing brace is not big. The only change is
the case label itself.

> I almost don't have an opinion on the alignment options. For much of my
> career I would group the * with the type rather than the variable (i.e.
> PAS_Left) because it made more intuitive sense. On one hand, it seems like
> most of the world now agrees. On the other, it's not the way things are in
> Gluster now and hence requires a change in habits.

I don't have a strong preference here either. I've never used the PAS_Right
alignment before working on gluster, so I can adapt to whatever alignment is
preferred. I only wanted to point out that if we want to go with PAS_Right, it
currently has an issue in combination with AlignConsecutiveDeclarations.

You are receiving this mail because:
You are on the CC list for the bug.
Unsubscribe from this bug https://bugzilla.redhat.com/token.cgi?t=rIzAzGvuih&a=cc_unsubscribe

More information about the Gluster-infra mailing list