check-webkit-style: cpp linter incorrectly treats colon appearing in a string argument as the start of the initializer list
https://bugs.webkit.org/show_bug.cgi?id=174315
Summary check-webkit-style: cpp linter incorrectly treats colon appearing in a string...
Matt Baker
Reported 2017-07-10 11:06:36 PDT
check-webkit-style's cpp linter incorrectly treats colon appearing in a string argument as the start of the initializer list, and emits an error if whitespace rules aren't followed. For example, running check-webkit-style on the following: MyClass::MyClass() : m_foo("foo:bar") { } Will output: ERROR: Missing spaces around : [whitespace/init] [4] Note: The problem is with the cpp linter regex, see Tools/Scripts/webkitpy/style/checkers/cpp.py:2043: # match the start of initialization list if search(r'^(?P<indentation>\s*)((explicit\s+)?[^(\s|\?)]+\([^\?]*\)\s?\:|^(\s|\?)*\:)([^\:]|\Z)[^;]*$', line): if search(r'[^:]\:[^\:\s]+', line): error(line_number, 'whitespace/init', 4, 'Missing spaces around :') ...
Attachments
Patch (2.17 KB, patch)
2017-07-10 17:24 PDT, Matt Baker
mattbaker: review-
Radar WebKit Bug Importer
Comment 1 2017-07-10 11:06:57 PDT
Matt Baker
Comment 2 2017-07-10 17:24:51 PDT
Matt Baker
Comment 3 2017-07-10 17:50:29 PDT
Comment on attachment 315052 [details] Patch r- for now. Need to improve on this (using elided over raw_lines feels risky), and add a test case to Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py.
Note You need to log in before you can comment on or make changes to this bug.