Code Style Guideline entry about a space in empty braces
Hi. I'm now working on clang-format refinement for WebKit style. Although pre-set for WebKit is unused on WebKit/WebKit itself as we see https://github.com/WebKit/WebKit/blob/e91b9416d35d02968ccb1554d14e94568c762b..., I'll add missing features of clang-format itself to make consistent with WebKit code style. A maintainer catches that we should take care about WebKit Code Style Guideline, in the patch that adds a missed feature https://github.com/llvm/llvm-project/pull/93634#discussion_r1632439352. So I wouldn't update WebKit pre-set on clang-format. I found Code Style Guideline misses an entry about empty braces, while check-webkit-style catches. I also created bugzilla ticket https://bugs.webkit.org/show_bug.cgi?id=275309 and candidate doc update patch https://github.com/WebKit/WebKit/pull/29668 Which is better to update Code Style Guideline or check-webkit-style? Thanks in advance. Kohei
On Fri, Jun 14 2024 at 07:37:36 AM +00:00:00, Kohei.Asano--- via webkit-dev <webkit-dev@lists.webkit.org> wrote:
I found Code Style Guideline misses an entry about empty braces, while check-webkit-style catches. I also created bugzilla ticket https://bugs.webkit.org/show_bug.cgi?id=275309 and candidate doc update patch https://github.com/WebKit/WebKit/pull/29668
Which is better to update Code Style Guideline or check-webkit-style?
Hi, The style guidelines should be updated; thanks for handling that. We already consistently follow this rule, since (as you've noticed) it's enforced by the script.
There is one section in the style guide about spacing around brace initialization <https://webkit.org/code-style-guidelines/#spacing-braced-init:~:text=href=%22%23-,spacing-braced-init,-%22%20name=>, which is a little informative and certainly applies for one class of empty braces. check-webkit-style helps satisfy said rule, but I think it’s overzealous in its identification of missing spaces inside an empty brace since the style guide doesn’t prescribe anything about this in general. Having said that, I think we should converge to unconditionally placing spaces inside empty braces, for which we would want to update the coding style guide. Conveniently, check-webkit-style has already been checking for that, so we must not have committed too many violations! (some grepping indicates 30141 instances of { } vs 626 instances of {} under Source/)
On Jun 14, 2024, at 00:37, Kohei.Asano--- via webkit-dev <webkit-dev@lists.webkit.org> wrote:
Hi. I'm now working on clang-format refinement for WebKit style. Although pre-set for WebKit is unused on WebKit/WebKit itself as we seehttps://github.com/WebKit/WebKit/blob/e91b9416d35d02968ccb1554d14e94568c762b..., I'll add missing features of clang-format itself to make consistent with WebKit code style.
A maintainer catches that we should take care about WebKit Code Style Guideline, in the patch that adds a missed featurehttps://github.com/llvm/llvm-project/pull/93634#discussion_r1632439352. So I wouldn't update WebKit pre-set on clang-format.
I found Code Style Guideline misses an entry about empty braces, while check-webkit-style catches. I also created bugzilla tickethttps://bugs.webkit.org/show_bug.cgi?id=275309 and candidate doc update patch https://github.com/WebKit/WebKit/pull/29668
Which is better to update Code Style Guideline or check-webkit-style?
Thanks in advance.
Kohei _______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org <mailto:webkit-dev@lists.webkit.org> https://lists.webkit.org/mailman/listinfo/webkit-dev
Thanks Michael and Abrar. Yeah I agree with what Abrar said. For clang-format, which has specific WebKit style, needs to care about the coding style so updating benefits for maintaining it. I’ll appreciate other comments about this on PR<https://github.com/WebKit/WebKit/pull/29668>. If there are no other opinions, could anyone merge this PR? Thanks! Kohei ________________________________ 差出人: Abrar Protyasha <a_protyasha@apple.com> 送信日時: 2024年6月15日 0:00 宛先: Asano, Kohei (SIE) <Kohei.Asano@sony.com> CC: webkit-dev@lists.webkit.org <webkit-dev@lists.webkit.org> 件名: Re: [webkit-dev] Code Style Guideline entry about a space in empty braces There is one section in the style guide about spacing around brace initialization<https://webkit.org/code-style-guidelines/#spacing-braced-init:~:text=href="#-,spacing-braced-init,-" name=>, which is a little informative and certainly applies for one class of empty braces. check-webkit-style helps satisfy said rule, but I think it’s overzealous in its identification of missing spaces inside an empty brace since the style guide doesn’t prescribe anything about this in general. Having said that, I think we should converge to unconditionally placing spaces inside empty braces, for which we would want to update the coding style guide. Conveniently, check-webkit-style has already been checking for that, so we must not have committed too many violations! (some grepping indicates 30141 instances of { } vs 626 instances of {} under Source/) On Jun 14, 2024, at 00:37, Kohei.Asano--- via webkit-dev <webkit-dev@lists.webkit.org> wrote: Hi. I'm now working on clang-format refinement for WebKit style. Although pre-set for WebKit is unused on WebKit/WebKit itself as we seehttps://github.com/WebKit/WebKit/blob/e91b9416d35d02968ccb1554d14e94568c762be5/.clang-format#L2<https://github.com/WebKit/WebKit/blob/e91b9416d35d02968ccb1554d14e94568c762be5/.clang-format#L2>, I'll add missing features of clang-format itself to make consistent with WebKit code style. A maintainer catches that we should take care about WebKit Code Style Guideline, in the patch that adds a missed featurehttps://github.com/llvm/llvm-project/pull/93634#discussion_r1632439352<https://github.com/llvm/llvm-project/pull/93634#discussion_r1632439352>. So I wouldn't update WebKit pre-set on clang-format. I found Code Style Guideline misses an entry about empty braces, while check-webkit-style catches. I also created bugzilla tickethttps://bugs.webkit.org/show_bug.cgi?id=275309<https://bugs.webkit.org/show_bug.cgi?id=275309> and candidate doc update patch https://github.com/WebKit/WebKit/pull/29668<https://github.com/WebKit/WebKit/pull/29668> Which is better to update Code Style Guideline or check-webkit-style? Thanks in advance. Kohei _______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org<mailto:webkit-dev@lists.webkit.org> https://lists.webkit.org/mailman/listinfo/webkit-dev<https://lists.webkit.org/mailman/listinfo/webkit-dev>
participants (3)
-
Abrar Protyasha
-
Kohei.Asano@sony.com
-
Michael Catanzaro