Relaxing the requirement to put a space in empty {}s?

35 views
Skip to first unread message

Jeffrey Yasskin

unread,
Jun 15, 2015, 5:57:39 PM6/15/15
to blink-dev, Daniel Jasper
`git cl format` currently turns:

virtual void func() { }

into

virtual void func() {}

which check-webkit-style complains about at
https://code.google.com/p/chromium/codesearch/#chromium/src/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp.py&l=2082.

In b/14651985 (sorry, non-Googlers) Daniel asks that Blink allow
either style in order to av complexity to clang-format.

What does blink-dev think?

Thanks,
Jeffrey

TAMURA, Kent

unread,
Jun 16, 2015, 2:10:54 AM6/16/15
to Jeffrey Yasskin, blink-dev, Daniel Jasper
IMO we should remove this style rule, and align with Chromium.  { + space + } has no advantage.

--
TAMURA Kent
Software Engineer, Google


Peter Kasting

unread,
Jun 16, 2015, 2:37:25 AM6/16/15
to Jeffrey Yasskin, blink-dev, Daniel Jasper
I would remove this style rule and not mandate either style -- both seem readable and IMO authors should be able to do either.

PK

Levi Weintraub

unread,
Jun 16, 2015, 3:31:19 AM6/16/15
to Peter Kasting, Jeffrey Yasskin, blink-dev, Daniel Jasper
I'm happy with both like Peter. If removing this rule gets us the ability to have an arbitrary amount of space, I'm not a fan. I'd prefer not to have only the Chromium style if that means moving code around can get the style checker to complain.

Dana Jansens

unread,
Jun 16, 2015, 1:27:37 PM6/16/15
to Levi Weintraub, Peter Kasting, Jeffrey Yasskin, blink-dev, Daniel Jasper
On Tue, Jun 16, 2015 at 12:30 AM, Levi Weintraub <le...@chromium.org> wrote:
I'm happy with both like Peter. If removing this rule gets us the ability to have an arbitrary amount of space, I'm not a fan. I'd prefer not to have only the Chromium style if that means moving code around can get the style checker to complain.

FWIW if you run git cl format on your change that moves code around you don't have to think about it.

Joshua Bell

unread,
Jun 16, 2015, 2:30:54 PM6/16/15
to Dana Jansens, Levi Weintraub, Peter Kasting, Jeffrey Yasskin, blink-dev, Daniel Jasper
ISTM we should:

(1) Rewrite the Blink C++ style guide [1] to be just deltas from the Chromium[2] (and transitively, Google[3]) C++ style guide.

(2) Strive, over time, to reduce the number of deltas.

I assume #1 is non-controversial? We can likely do without the Objective-C rules now. A quick glance suggests about half the rules are obsolete or redundant with Chromium (...) style. What I don't know is if these rules match style checking tools that don't themselves "fall back" to the Chromium (...) style.

#2 is, of course, more opinionated, and is intended to codify that when an option presents itself we lean towards reducing the number of special cases (e.g. FIXME->TODO, { } -> {}, etc), not that we clang-rewrite accidentally the whole thing.



Reply all
Reply to author
Forward
0 new messages