Bug 27378
Summary: | cpplint has some issues with one lines if-sentences | ||
---|---|---|---|
Product: | WebKit | Reporter: | Kenneth Rohde Christiansen <kenneth> |
Component: | Tools / Tests | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | Normal | CC: | manyoso, mrowe |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | PC | ||
OS: | All |
Kenneth Rohde Christiansen
The following is legal according to the coding style document, but cpplint complains about it.
At least I was told that on the IRC once.
if (something) {
method1();
method2();
} else {
method3();
}
Example:
WebKit/qt/Api/qwebpage.cpp:2409: One line control clauses should not use braces. [whitespace/braces] [4]
2404 if (subString.isEmpty()) {
2405 d->page->unmarkAllTextMatches();
2406 return true;
2407 } else {
2408 return d->page->markAllMatchesForText(subString, caseSensitivity, true, 0);
2409 }
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Mark Rowe (bdash)
The coding style states that there should be no braces around the body of the else, so the complaint is correct.
Kenneth Rohde Christiansen
Yes, I got this one wrong, and will update our Qt sources accordingly. Thanks bdash.
Am I supposed to close this bug, or just leave it as resolved?
Adam Treat
Resolved means it is closed :)
Kenneth Rohde Christiansen
Ah OK. :-) Just got confused as there is a separate CLOSE item in the status dropdown menu.