WebKit Bugzilla
Attachment 359759 Details for
Bug 193676
: check-webkit-style reports false-positive whitespace/init warning in C++ initialization parameters
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch v1
bug-193676-20190122115734.patch (text/plain), 6.28 KB, created by
David Kilzer (:ddkilzer)
on 2019-01-22 11:57:34 PST
(
hide
)
Description:
Patch v1
Filename:
MIME Type:
Creator:
David Kilzer (:ddkilzer)
Created:
2019-01-22 11:57:34 PST
Size:
6.28 KB
patch
obsolete
>Subversion Revision: 240247 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index b6f1f0036c158aac94cd953e349e902134b3c876..5e8a6485ae0c53191524af654269dcf72c9a1862 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,20 @@ >+2019-01-22 David Kilzer <ddkilzer@apple.com> >+ >+ check-webkit-style reports false-positive whitespace/init warning in C++ initialization parameters >+ <https://webkit.org/b/193676> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Scripts/webkitpy/style/checkers/cpp.py: >+ (check_member_initialization_list): >+ - Don't report missing whitespace around colon if the colon at >+ the start of the line is formatted correctly. >+ * Scripts/webkitpy/style/checkers/cpp_unittest.py: >+ (WebKitStyleTest.test_member_initialization_list): >+ - Add a test for a missing permutation of existing tests. >+ - Add a test this false-positive. >+ - Add blank lines between subtests to make them easier to read. >+ > 2019-01-21 Fujii Hironori <Hironori.Fujii@sony.com> > > [GTK][WPE] libgcrypt-1.7.6 can't be compiled on Ubuntu 18.10 >diff --git a/Tools/Scripts/webkitpy/style/checkers/cpp.py b/Tools/Scripts/webkitpy/style/checkers/cpp.py >index be373cf8a89ee449d97976079a362a42486f12af..bf07592eb06d9c139c936d4bdb4ea197f00fc5c6 100644 >--- a/Tools/Scripts/webkitpy/style/checkers/cpp.py >+++ b/Tools/Scripts/webkitpy/style/checkers/cpp.py >@@ -2104,7 +2104,7 @@ def check_member_initialization_list(clean_lines, line_number, error): > begin_line = line > # match the start of initialization list > if search(r'^(?P<indentation>\s*)((explicit\s+)?[^(\s|\?)]+\([^\?]*\)\s?\:|^(\s|\?)*\:)([^\:]|\Z)[^;]*$', line): >- if search(r'[^:]\:[^\:\s]+', line): >+ if search(r'[^:]\:[^\:\s]+', line) and not search(r'^\s*:\s\S+', line): > error(line_number, 'whitespace/init', 4, > 'Missing spaces around :') > if (not line.lstrip().startswith(':')) and search(r'[^\s]\(.*\)\s?\:.*[^;]*$', line): >diff --git a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py >index 78f2f1dc495b3161219869d3803081ef622154f6..ebff051d32f700dadef5468c382cea6387392517 100644 >--- a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py >+++ b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py >@@ -5503,26 +5503,31 @@ class WebKitStyleTest(CppStyleTestBase): > 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]') >+ > self.assert_multi_line_lint(( > 'MyClass::MyClass(Document* doc)\n' > ' : m_myMember(b ? bar() : baz())\n' > ' , MySuperClass()\n' > ' , m_doc(0)\n' > '{ }'), '') >+ > self.assert_multi_line_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]') >+ > self.assert_multi_line_lint('''\ > MyClass::MyClass(Document* doc) > : MySuperClass() > { }''', > 'Wrong number of spaces before statement. (expected: 12)' > ' [whitespace/indent] [4]') >+ > self.assert_multi_line_lint('''\ > MyClass::MyClass(Document* doc) : > MySuperClass(), >@@ -5532,18 +5537,27 @@ class WebKitStyleTest(CppStyleTestBase): > ' [whitespace/indent] [4]', > 'Comma should be at the beginning of the line in a member initialization list.' > ' [whitespace/init] [4]']) >+ >+ self.assert_multi_line_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]') >+ > self.assert_multi_line_lint('''\ > MyClass::MyClass(Document* doc) :MySuperClass() > { }''', > ['Missing spaces around : [whitespace/init] [4]', > 'Should be indented on a separate line, with the colon or comma first on that line.' > ' [whitespace/indent] [4]']) >+ > self.assert_multi_line_lint('''\ > MyClass::MyClass(Document* doc):MySuperClass() > { }''', > ['Missing spaces around : [whitespace/init] [4]', > 'Should be indented on a separate line, with the colon or comma first on that line.' > ' [whitespace/indent] [4]']) >+ > self.assert_multi_line_lint('''\ > MyClass::MyClass(Document* doc) : MySuperClass() > ,MySuperClass() >@@ -5582,6 +5596,7 @@ class WebKitStyleTest(CppStyleTestBase): > :MySuperClass() > { }''', > 'Missing spaces around : [whitespace/init] [4]') >+ > self.assert_multi_line_lint('''\ > MyClass::MyClass(Document* doc) > : MySuperClass() , >@@ -5589,23 +5604,35 @@ class WebKitStyleTest(CppStyleTestBase): > { }''', > 'Comma should be at the beginning of the line in a member initialization list.' > ' [whitespace/init] [4]') >+ > self.assert_multi_line_lint('''\ > class MyClass : public Goo { > };''', > '') >+ > self.assert_multi_line_lint('''\ > class MyClass > : public Goo > , public foo { > };''', > '') >+ > self.assert_multi_line_lint('''\ > MyClass::MyClass(Document* doc) > : MySuperClass(doc, doc) > { }''', > '') >+ >+ self.assert_multi_line_lint('''\ >+ PreviewConverter::PreviewConverter(NSData *data, const String& uti, const String& password) >+ : m_platformConverter { adoptNS([allocQLPreviewConverterInstance() initWithData:data name:nil uti:uti options:optionsWithPassword(password)]) } >+ { }''', >+ '') >+ > self.assert_lint('::ShowWindow(m_overlay);', '') >+ > self.assert_lint('o = foo(b ? bar() : baz());', '') >+ > self.assert_lint('MYMACRO(a ? b() : c);', '') > > def test_min_versions_of_wk_api_available(self):
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193676
: 359759