⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 160124 in webkit


Ignore:
Timestamp:
Dec 4, 2013, 2:16:30 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

check-webkit-style detected some ternary statements as initialization lists
https://bugs.webkit.org/show_bug.cgi?id=125246

Patch by Myles C. Maxfield <mmaxfield@apple.com> on 2013-12-04
Reviewed by Dean Jackson.

The regular expression that check-webkit-tests uses to detect initialization
lists was too broad, resulting in false positives. This patch makes the
regex more specific

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

(check_member_initialization_list):

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

(WebKitStyleTest.test_member_initialization_list):

Location:
trunk/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r160108 r160124  
     12013-12-04  Myles C. Maxfield  <mmaxfield@apple.com>
     2
     3        check-webkit-style detected some ternary statements as initialization lists
     4        https://bugs.webkit.org/show_bug.cgi?id=125246
     5
     6        Reviewed by Dean Jackson.
     7
     8        The regular expression that check-webkit-tests uses to detect initialization
     9        lists was too broad, resulting in false positives. This patch makes the
     10        regex more specific
     11
     12        * Scripts/webkitpy/style/checkers/cpp.py:
     13        (check_member_initialization_list):
     14        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
     15        (WebKitStyleTest.test_member_initialization_list):
     16
    1172013-12-04  Mark Hahnenberg  <mhahnenberg@apple.com>
    218
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py

    r160086 r160124  
    19871987    # with the colon or comma preceding the member on that line.
    19881988    begin_line = line
    1989     if search(r'(?P<indentation>\s*)([^\s]\(.*\)\s?\:|^\s*\:).*[^;]*$', line):
     1989    if search(r'^(?P<indentation>\s*)((explicit\s+)?[^\s]+\(.*\)\s?\:|^\s*\:).*[^;]*$', line):
    19901990        if search(r'[^:]\:[^\:\s]+', line):
    19911991            error(line_number, 'whitespace/init', 4,
  • trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

    r160086 r160124  
    49154915
    49164916    def test_member_initialization_list(self):
     4917        self.assert_lint('explicit MyClass(Document* doc) : MySuperClass() { }',
     4918        'Should be indented on a separate line, with the colon or comma first on that line.'
     4919        '  [whitespace/indent] [4]')
    49174920        self.assert_lint('MyClass::MyClass(Document* doc) : MySuperClass() { }',
    49184921        'Should be indented on a separate line, with the colon or comma first on that line.'
     
    49844987        };''',
    49854988        '')
     4989        self.assert_lint('o = foo(b ? bar() : baz());', '')
    49864990
    49874991    def test_other(self):
Note: See TracChangeset for help on using the changeset viewer.