Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Issue 15747011: Enforced new rules for braces in conditional and loop bodies in style checker. (Closed)

Created:
7 years, 7 months ago by Ken Russell (switch to Gerrit)
Modified:
7 years, 6 months ago
CC:
blink-reviews, eae+blinkwatch
Visibility:
Public.

Description

Enforced new rules for braces in conditional and loop bodies in style checker. Consensus was reached on blink-dev to change the style rules for braces in conditional and loop bodies (previously called "control clauses"). Previously, braces were forbidden for single-line conditionals like if (condition) doSomething(); Now, as in Google's C++ style guide, braces are optional in this case. The style checker now enforces the following rules: - Braces are required for single, multi-line statements in conditionals and loop bodies. - If any arm of an if/else statement uses braces, all must use them. Once this lands, section "Braces" in the style guide will be updated with the following rules adapted from the Google C++ style guide, with examples: - Rule 3 ("One-line control clauses...") will be removed. - 3. Curly braces are not required for single-line conditional or loop bodies, but are required for single-statement bodies that span multiple lines. [braces-single-line] - 4. If one part of an if-else statement uses curly braces, the other part must too. [braces-must-match] Note that much existing Blink code will be in violation of the new style; it will have to be updated incrementally. BUG=242696 R=eseidel@chromium.org Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=151858

Patch Set 1 #

Patch Set 2 : Updated numbering in unit test. #

Patch Set 3 : Rebased. #

Patch Set 4 : Clarified terminology based on feedback from Peter Kasting. #

Patch Set 5 : Updated terminology in comments. #

Total comments: 1

Patch Set 6 : #

Patch Set 7 : Rebased. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+382 lines, -73 lines) Patch
M Tools/Scripts/webkitpy/style/checkers/cpp.py View 1 2 3 4 chunks +146 lines, -11 lines 0 comments Download
M Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py View 1 2 3 4 8 chunks +236 lines, -62 lines 0 comments Download

Messages

Total messages: 26 (0 generated)
Ken Russell (switch to Gerrit)
Please review. Thanks.
7 years, 7 months ago (2013-05-22 22:33:13 UTC) #1
Dirk Pranke
I don't really know the style checker code that well (it was mostly levin's code ...
7 years, 7 months ago (2013-05-24 00:55:58 UTC) #2
eseidel
lgtm
7 years, 7 months ago (2013-05-24 01:04:47 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kbr@chromium.org/15747011/9001
7 years, 7 months ago (2013-05-24 01:04:59 UTC) #4
commit-bot: I haz the power
Retried try job too often on linux_layout_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_layout_rel&number=9800
7 years, 7 months ago (2013-05-24 02:21:08 UTC) #5
abarth-chromium
https://codereview.chromium.org/15747011/diff/9001/PRESUBMIT.py File PRESUBMIT.py (right): https://codereview.chromium.org/15747011/diff/9001/PRESUBMIT.py#newcode52 PRESUBMIT.py:52: results.extend(_CheckStyle(input_api, output_api)) This seems like a separate issue from ...
7 years, 7 months ago (2013-05-24 06:06:39 UTC) #6
Dirk Pranke
On 2013/05/24 06:06:39, abarth wrote: > https://codereview.chromium.org/15747011/diff/9001/PRESUBMIT.py > File PRESUBMIT.py (right): > > https://codereview.chromium.org/15747011/diff/9001/PRESUBMIT.py#newcode52 > ...
7 years, 7 months ago (2013-05-24 16:24:07 UTC) #7
abarth-chromium
On 2013/05/24 16:24:07, Dirk Pranke wrote: > Ken ran that part by me originally and ...
7 years, 7 months ago (2013-05-24 16:57:06 UTC) #8
Dirk Pranke
On 2013/05/24 16:57:06, abarth wrote: > On 2013/05/24 16:24:07, Dirk Pranke wrote: > > Ken ...
7 years, 7 months ago (2013-05-24 17:01:41 UTC) #9
Ken Russell (switch to Gerrit)
On 2013/05/24 17:01:41, Dirk Pranke wrote: > On 2013/05/24 16:57:06, abarth wrote: > > On ...
7 years, 6 months ago (2013-05-28 15:58:17 UTC) #10
Dirk Pranke
On 2013/05/28 15:58:17, kbr wrote: > On 2013/05/24 17:01:41, Dirk Pranke wrote: > > On ...
7 years, 6 months ago (2013-05-28 16:28:18 UTC) #11
Ken Russell (switch to Gerrit)
On 2013/05/28 16:28:18, Dirk Pranke wrote: > git-cl presubmit -u/--upload . Thanks. OK to CQ ...
7 years, 6 months ago (2013-05-28 19:12:39 UTC) #12
Dirk Pranke
On 2013/05/28 19:12:39, kbr wrote: > On 2013/05/28 16:28:18, Dirk Pranke wrote: > > git-cl ...
7 years, 6 months ago (2013-05-28 19:19:46 UTC) #13
abarth-chromium
Yes, thanks!
7 years, 6 months ago (2013-05-28 19:42:41 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kbr@chromium.org/15747011/30001
7 years, 6 months ago (2013-05-28 19:42:48 UTC) #15
commit-bot: I haz the power
Retried try job too often on blink_presubmit for step(s) presubmit http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=blink_presubmit&number=707
7 years, 6 months ago (2013-05-28 20:05:40 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kbr@chromium.org/15747011/30001
7 years, 6 months ago (2013-05-28 21:06:21 UTC) #17
commit-bot: I haz the power
Retried try job too often on win_layout_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_layout_rel&number=7236
7 years, 6 months ago (2013-05-29 00:14:17 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kbr@chromium.org/15747011/30001
7 years, 6 months ago (2013-05-29 15:01:27 UTC) #19
commit-bot: I haz the power
Retried try job too often on win_layout_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_layout_rel&number=7452
7 years, 6 months ago (2013-05-29 18:21:13 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kbr@chromium.org/15747011/30001
7 years, 6 months ago (2013-05-29 22:20:21 UTC) #21
commit-bot: I haz the power
Retried try job too often on win_layout_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_layout_rel&number=7550
7 years, 6 months ago (2013-05-30 00:49:23 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/kbr@chromium.org/15747011/59001
7 years, 6 months ago (2013-06-04 23:45:46 UTC) #23
commit-bot: I haz the power
Retried try job too often on linux_layout_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_layout_rel&number=11497
7 years, 6 months ago (2013-06-05 01:08:36 UTC) #24
Ken Russell (switch to Gerrit)
Committed patchset #7 manually as r151858 (presubmit successful).
7 years, 6 months ago (2013-06-05 18:20:00 UTC) #25
levin
7 years, 6 months ago (2013-06-05 22:30:40 UTC) #26
Message was sent while issue was closed.
On 2013/05/24 00:55:58, Dirk Pranke wrote:
> I don't really know the style checker code that well (it was mostly levin's
code
> originally, I think). Eric, Adam, would either of you be better suited to
review
> this?

Just for kicks, some historic info.

The style checker is forked from what Google has used internally and released
publicly a while ago. Albert Wong got the licensed changed to something
acceptable for WebKit. Shinichiro Hamaji did the work to make it conform to
WebKit style (both the code and the checks), and I did the initial reviews for
him and many of the initial changes. (And I did some changes.)

Team effort of lots of people especially if you consider the Google history as
well.

Powered by Google App Engine
This is Rietveld 408576698