Bug 177897 - check-webkit-style erroneously requires a space between the caret and brace in obj-c blocks.
Summary: check-webkit-style erroneously requires a space between the caret and brace i...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Megan Gardner
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-10-04 14:00 PDT by Megan Gardner
Modified: 2017-10-05 15:42 PDT (History)
9 users (show)

See Also:


Attachments
Patch (1.51 KB, patch)
2017-10-04 14:57 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (2.84 KB, patch)
2017-10-04 15:22 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch (3.42 KB, patch)
2017-10-04 16:38 PDT, Megan Gardner
dbates: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Megan Gardner 2017-10-04 14:00:01 PDT
Check webkit style throws an error when you do not put a space between the ^ and the { for objective-c blocks. It was made so with the changes for this bug: https://bugs.webkit.org/show_bug.cgi?id=161247 But there is agreement that this should not be the case, and a space should not be required. A vast majority of the code in webkit already conforms to this style, with only a few outliers.
Comment 1 Megan Gardner 2017-10-04 14:57:52 PDT
Created attachment 322730 [details]
Patch
Comment 2 Megan Gardner 2017-10-04 15:15:16 PDT
I need to expand this, new patch forthcoming
Comment 3 Megan Gardner 2017-10-04 15:22:09 PDT
Created attachment 322732 [details]
Patch
Comment 4 Jonathan Bedard 2017-10-04 15:41:22 PDT
If you look at comment 5 in <https://bugs.webkit.org/show_bug.cgi?id=161247>, I specifically call out the problem Megan is addressing here... I'm not an Objective C programmer, and the WebKit style guide gives some conflicting advice on this.

This seems like the right change, especially since you've seemed agreement with others more familiar than I with Objective C style.
Comment 5 Megan Gardner 2017-10-04 16:38:34 PDT
Created attachment 322739 [details]
Patch
Comment 6 Jonathan Bedard 2017-10-04 16:43:03 PDT
Comment on attachment 322739 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322739&action=review

Unofficial R+, but please edit the ChangeLog to reflect the new behavior

> Tools/ChangeLog:8
> +        Remove the check for a space between ^ and {, 

To clarify, this change does the opposite of the original code, right?  Now the style checker will enforce that there is NOT a space between ^ and { in an objective-C block.
Comment 7 Daniel Bates 2017-10-04 23:52:31 PDT
Comment on attachment 322739 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=322739&action=review

> Tools/ChangeLog:3
> +        check-webkit-style erroneously requires a space between the carrot and brace in obj-c blocks.

Blocks are not specific to Objective-C.

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html

> Tools/Scripts/webkitpy/style/checkers/cpp.py:1265
> +        if search(r'\^\s\{', group):

Would it make sense to check for one or more space characters, \s+? If so, please add additional tests.
Comment 8 Megan Gardner 2017-10-05 15:41:42 PDT
https://trac.webkit.org/r222937
Comment 9 Radar WebKit Bug Importer 2017-10-05 15:42:48 PDT
<rdar://problem/34845080>