Changeset 219577 in webkit


Ignore:
Timestamp:
Jul 17, 2017 3:40:18 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Update style checker to deal with "final"
https://bugs.webkit.org/show_bug.cgi?id=174528

Patch by Yoshiaki Jitsukawa <Yoshiaki.Jitsukawa@sony.com> on 2017-07-17
Reviewed by Alex Christensen.

check-webkit-style shouldn't complain about an open brace to start a
line after a function definition with "final" or "const final".

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

(check_braces):

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

(CppStyleTest.test_brace_at_begin_of_line):

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r219573 r219577  
     12017-07-17  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
     2
     3        Update style checker to deal with "final"
     4        https://bugs.webkit.org/show_bug.cgi?id=174528
     5
     6        Reviewed by Alex Christensen.
     7       
     8        check-webkit-style shouldn't complain about an open brace to start a
     9        line after a function definition with "final" or "const final".
     10
     11        * Scripts/webkitpy/style/checkers/cpp.py:
     12        (check_braces):
     13        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
     14        (CppStyleTest.test_brace_at_begin_of_line):
     15
    1162017-07-17  Alex Christensen  <achristensen@webkit.org>
    217
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py

    r218553 r219577  
    24312431        # and '- (' and '+ (' for Objective-C methods.
    24322432        previous_line = get_previous_non_blank_line(clean_lines, line_number)[0]
    2433         if ((not search(r'[;:}{)=]\s*$|\)\s*((const|override|const override)\s*)?(->\s*\S+)?\s*$', previous_line)
     2433        if ((not search(r'[;:}{)=]\s*$|\)\s*((const|override|const override|final|const final)\s*)?(->\s*\S+)?\s*$', previous_line)
    24342434             or search(r'\b(if|for|while|switch|else|NS_ENUM)\b', previous_line)
    24352435             or regex_for_lambdas_and_blocks(previous_line, line_number, file_state, error))
     
    24392439            error(line_number, 'whitespace/braces', 4,
    24402440                  'This { should be at the end of the previous line')
    2441     elif (search(r'\)\s*(((const|override)\s*)*\s*)?{\s*$', line)
     2441    elif (search(r'\)\s*(((const|override|final)\s*)*\s*)?{\s*$', line)
    24422442          and line.count('(') == line.count(')')
    24432443          and not search(r'(\s*(if|for|while|switch|NS_ENUM|@synchronized)|} @catch)\b', line)
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

    r219191 r219577  
    17931793            'Place brace on its own line for function definitions.  [whitespace/braces] [4]')
    17941794        self.assert_multi_line_lint(
     1795            'int foo() const final {',
     1796            'Place brace on its own line for function definitions.  [whitespace/braces] [4]')
     1797        self.assert_multi_line_lint(
     1798            'int foo() final {',
     1799            'Place brace on its own line for function definitions.  [whitespace/braces] [4]')
     1800        self.assert_multi_line_lint(
    17951801            'int foo() const\n'
    17961802            '{\n'
     
    17991805        self.assert_multi_line_lint(
    18001806            'int foo() override\n'
     1807            '{\n'
     1808            '}\n',
     1809            '')
     1810        self.assert_multi_line_lint(
     1811            'int foo() final\n'
    18011812            '{\n'
    18021813            '}\n',
     
    18191830        self.assert_multi_line_lint(
    18201831            'int foo() const override\n'
     1832            '{\n'
     1833            '}\n',
     1834            '')
     1835        self.assert_multi_line_lint(
     1836            'int foo() const final\n'
    18211837            '{\n'
    18221838            '}\n',
Note: See TracChangeset for help on using the changeset viewer.