Title: [160461] trunk/Tools
- Revision
- 160461
- Author
- [email protected]
- Date
- 2013-12-11 15:05:52 -0800 (Wed, 11 Dec 2013)
Log Message
check-webkit-style can't determine if a comma is part of an initialization list
https://bugs.webkit.org/show_bug.cgi?id=125537
Patch by Myles C. Maxfield <[email protected]> on 2013-12-11
Reviewed by Darin Adler.
The original check to make sure that initialization list lines start with
a comma didn't distinguish between commas that belong to the initialization
list and commas that are part of function calls. Because we don't want to
match parentheses with regular expressions, we should weaken this check to
only check for commas at the end of initialization list lines.
* 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 (160460 => 160461)
--- trunk/Tools/ChangeLog 2013-12-11 23:00:08 UTC (rev 160460)
+++ trunk/Tools/ChangeLog 2013-12-11 23:05:52 UTC (rev 160461)
@@ -1,3 +1,21 @@
+2013-12-11 Myles C. Maxfield <[email protected]>
+
+ check-webkit-style can't determine if a comma is part of an initialization list
+ https://bugs.webkit.org/show_bug.cgi?id=125537
+
+ Reviewed by Darin Adler.
+
+ The original check to make sure that initialization list lines start with
+ a comma didn't distinguish between commas that belong to the initialization
+ list and commas that are part of function calls. Because we don't want to
+ match parentheses with regular expressions, we should weaken this check to
+ only check for commas at the end of initialization list lines.
+
+ * Scripts/webkitpy/style/checkers/cpp.py:
+ (check_member_initialization_list):
+ * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+ (WebKitStyleTest.test_member_initialization_list):
+
2013-12-11 Tim Horton <[email protected]>
Make it possible to compare layout test results between various configurations of WebKit
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py (160460 => 160461)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2013-12-11 23:00:08 UTC (rev 160460)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py 2013-12-11 23:05:52 UTC (rev 160461)
@@ -2021,7 +2021,7 @@
if not line.startswith(inner_indentation) and begin_line != line:
error(line_number, 'whitespace/indent', 4,
'Wrong number of spaces before statement. (expected: %d)' % len(inner_indentation))
- if search(r'\S\s*,', line):
+ if search(r'\S\s*,\s*$', line):
error(line_number, 'whitespace/init', 4,
'Comma should be at the beginning of the line in a member initialization list.')
Modified: trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (160460 => 160461)
--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2013-12-11 23:00:08 UTC (rev 160460)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py 2013-12-11 23:05:52 UTC (rev 160461)
@@ -4975,7 +4975,8 @@
'Missing spaces around : [whitespace/init] [4]')
self.assert_multi_line_lint('''\
MyClass::MyClass(Document* doc)
- : MySuperClass() , m_doc(0)
+ : MySuperClass() ,
+ m_doc(0)
{ }''',
'Comma should be at the beginning of the line in a member initialization list.'
' [whitespace/init] [4]')
@@ -4989,6 +4990,11 @@
, public foo {
};''',
'')
+ self.assert_multi_line_lint('''\
+ MyClass::MyClass(Document* doc)
+ : MySuperClass(doc, doc)
+ { }''',
+ '')
self.assert_lint('o = foo(b ? bar() : baz());', '')
self.assert_lint('MYMACRO(a ? b() : c);', '')
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes