Title: [160124] trunk/Tools
Revision
160124
Author
[email protected]
Date
2013-12-04 14:16:30 -0800 (Wed, 04 Dec 2013)

Log 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 <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (160123 => 160124)


--- trunk/Tools/ChangeLog	2013-12-04 22:13:17 UTC (rev 160123)
+++ trunk/Tools/ChangeLog	2013-12-04 22:16:30 UTC (rev 160124)
@@ -1,3 +1,19 @@
+2013-12-04  Myles C. Maxfield  <[email protected]>
+
+        check-webkit-style detected some ternary statements as initialization lists
+        https://bugs.webkit.org/show_bug.cgi?id=125246
+
+        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):
+
 2013-12-04  Mark Hahnenberg  <[email protected]>
 
         run-jsc-stress-tests can only run locally

Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (160123 => 160124)


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2013-12-04 22:13:17 UTC (rev 160123)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2013-12-04 22:16:30 UTC (rev 160124)
@@ -1986,7 +1986,7 @@
     # Each member (and superclass) should be indented on a separate line,
     # with the colon or comma preceding the member on that line.
     begin_line = line
-    if search(r'(?P<indentation>\s*)([^\s]\(.*\)\s?\:|^\s*\:).*[^;]*$', line):
+    if search(r'^(?P<indentation>\s*)((explicit\s+)?[^\s]+\(.*\)\s?\:|^\s*\:).*[^;]*$', line):
         if search(r'[^:]\:[^\:\s]+', line):
             error(line_number, 'whitespace/init', 4,
                 'Missing spaces around :')

Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (160123 => 160124)


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2013-12-04 22:13:17 UTC (rev 160123)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2013-12-04 22:16:30 UTC (rev 160124)
@@ -4914,6 +4914,9 @@
                 webkit_export_error_rules))
 
     def test_member_initialization_list(self):
+        self.assert_lint('explicit MyClass(Document* doc) : MySuperClass() { }',
+        'Should be indented on a separate line, with the colon or comma first on that line.'
+        '  [whitespace/indent] [4]')
         self.assert_lint('MyClass::MyClass(Document* doc) : MySuperClass() { }',
         'Should be indented on a separate line, with the colon or comma first on that line.'
         '  [whitespace/indent] [4]')
@@ -4983,6 +4986,7 @@
         , public foo {
         };''',
         '')
+        self.assert_lint('o = foo(b ? bar() : baz());', '')
 
     def test_other(self):
         # FIXME: Implement this.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to