RESOLVED FIXED 27615
Fix false positives for switch statement indentation check in cpplint
https://bugs.webkit.org/show_bug.cgi?id=27615
Summary Fix false positives for switch statement indentation check in cpplint
Jakob Petsovits
Reported 2009-07-23 12:14:52 PDT
Mike Fenton brought to my attention that code like the following throws an indentation warning in cpplint: switch (blah) { default: break; } As far as I can see, the styleguide doesn't specifically allow these kinds of one-liners, but it also doesn't forbid them. And anyways, the error message for the indentation check would be wrong in this case anyways: "A case label should not be indented, but line up with its switch statement." The patch below fixes this issues by making the case label regex more permissive (hm... deja-vu?). It also adds more testcases and only ends the check when the (supposed) closing brace for the switch is actually on the same level of indentation as the switch statement itself. And a slight restructuring of comments and (el)ifs for better readability.
Attachments
Fix false positives for switch statement indentation check in cpplint (5.48 KB, patch)
2009-07-23 12:35 PDT, Jakob Petsovits
manyoso: review+
Jakob Petsovits
Comment 1 2009-07-23 12:35:36 PDT
Created attachment 33354 [details] Fix false positives for switch statement indentation check in cpplint
David Levin
Comment 2 2009-07-23 13:18:40 PDT
I haven't looked at the patch in depth yet... but it feels like the it should be not only "return" but also "break" or even "continue". I think the intent is to not put an "else" if you don't need to. Ironic, huh ? :)
Adam Treat
Comment 3 2009-07-23 15:54:18 PDT
Landed with r46294.
Note You need to log in before you can comment on or make changes to this bug.