Changeset 270068 in webkit


Ignore:
Timestamp:
Nov 19, 2020 9:48:42 PM (3 years ago)
Author:
commit-queue@webkit.org
Message:

check-webkit-style: requires spaces around the equal sign for Objective-C @synthesize.
https://bugs.webkit.org/show_bug.cgi?id=219092

Patch by Hoa Dinh <dvh@apple.com> on 2020-11-19
Reviewed by Wenson Hsieh.

Teach the Objective-C style checker to prefer @synthesize a = b over @synthesize a=b. As a followup,
<webkit.org/b/219094> will apply this style rule in existing @synthesize statements in WebKit.

  • Scripts/webkitpy/style/checkers/cpp.py:

(check_spacing):

  • Scripts/webkitpy/style/checkers/cpp_unittest.py:

(CppStyleTest):

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r270063 r270068  
     12020-11-19  Hoa Dinh  <dvh@apple.com>
     2
     3        check-webkit-style: requires spaces around the equal sign for Objective-C @synthesize.
     4        https://bugs.webkit.org/show_bug.cgi?id=219092
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        Teach the Objective-C style checker to prefer `@synthesize a = b` over `@synthesize a=b`. As a followup,
     9        <webkit.org/b/219094> will apply this style rule in existing @synthesize statements in WebKit.
     10
     11        * Scripts/webkitpy/style/checkers/cpp.py:
     12        (check_spacing):
     13        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
     14        (CppStyleTest):
     15
    1162020-11-19  James Darpinian  <jdarpinian@chromium.org>
    217
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py

    r269205 r270068  
    22022202    is_objective_c_synthesize = search(r'^@synthesize', line)
    22032203    if is_objective_c_synthesize:
    2204         # "prop=_varName" not "prop = _varName"
    2205         if search(r'(\s+=|=\s+)', line):
     2204        # "prop = _varName" not "prop=_varName"
     2205        # We skip the check in case @synthesize is used without equal.
     2206        if search(r'=', line) and not search(r'\s+=\s+', line):
    22062207            error(line_number, 'whitespace/property', 4,
    2207                   'Should not have spaces around = in property synthesis.')
     2208                  'Should have spaces around = in property synthesis.')
    22082209
    22092210    # Don't try to do spacing checks for operator methods
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

    r267917 r270068  
    21062106                         '  [whitespace/parens] [4]')
    21072107        self.assert_lint('@property (readonly) NSUInteger count;', '')
     2108        self.assert_lint('@synthesize a = b;', '')
     2109        self.assert_lint('@synthesize a=b;', 'Should have spaces around = in property synthesis.  [whitespace/property] [4]')
     2110        self.assert_lint('@synthesize a;', '')
    21082111        self.assert_lint('#elif (foo(bar))', '')
    21092112        self.assert_lint('#elif (foo(bar) && foo(baz))', '')
Note: See TracChangeset for help on using the changeset viewer.