Title: [226938] trunk/Tools
Revision
226938
Author
ddkil...@apple.com
Date
2018-01-13 12:38:04 -0800 (Sat, 13 Jan 2018)

Log Message

check-webkit-style: false positive for [whitespace/braces] with os_log format string
<https://webkit.org/b/181606>

Reviewed by Darin Adler.

* Scripts/webkitpy/style/checkers/cpp.py:
(check_spacing): Modify regular _expression_ to ignore
os_log format strings like '%{public}'.
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(CppStyleTest.test_spacing_before_braces): Add os_log
format string test.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (226937 => 226938)


--- trunk/Tools/ChangeLog	2018-01-13 15:16:23 UTC (rev 226937)
+++ trunk/Tools/ChangeLog	2018-01-13 20:38:04 UTC (rev 226938)
@@ -1,3 +1,17 @@
+2018-01-13  David Kilzer  <ddkil...@apple.com>
+
+        check-webkit-style: false positive for [whitespace/braces] with os_log format string
+        <https://webkit.org/b/181606>
+
+        Reviewed by Darin Adler.
+
+        * Scripts/webkitpy/style/checkers/cpp.py:
+        (check_spacing): Modify regular _expression_ to ignore
+        os_log format strings like '%{public}'.
+        * Scripts/webkitpy/style/checkers/cpp_unittest.py:
+        (CppStyleTest.test_spacing_before_braces): Add os_log
+        format string test.
+
 2018-01-12  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [macOS] API tests ChangeAttachmentDataUpdatesWithInPlaceDisplay and InPlaceVideoAttachmentInsertionWithinList are failing

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


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2018-01-13 15:16:23 UTC (rev 226937)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py	2018-01-13 20:38:04 UTC (rev 226938)
@@ -1969,11 +1969,11 @@
     # Next we will look for issues with function calls.
     check_spacing_for_function_call(line, line_number, file_state, error)
 
-    # Except after an opening paren, ^ for blocks, or @ for Objective-C
-    # literal NSDictionary, you should have spaces before your braces.
-    # Since you should never have braces at the beginning of a line, this
-    # is an easy test.
-    if search(r'[^ ({\^@]{', line):
+    # Except after an opening paren, ^ for blocks, @ for Objective-C literal
+    # NSDictionary, or os_log format parameters, you should have spaces before
+    # your braces. Since you should never have braces at the beginning of a
+    # line, this is an easy test.
+    if search(r'[^ ({\^@%]{', line):
         error(line_number, 'whitespace/braces', 5,
               'Missing space before {')
 

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


--- trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2018-01-13 15:16:23 UTC (rev 226937)
+++ trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py	2018-01-13 20:38:04 UTC (rev 226938)
@@ -1924,6 +1924,7 @@
         self.assert_lint('dispatch_async(dispatch_get_main_queue(), ^{', '')
         self.assert_lint('[outOfBandTracks.get() addObject:@{', '')
         self.assert_lint('EXPECT_DEBUG_DEATH({', '')
+        self.assert_lint('LOCAL_LOG(R"({ "url": "%{public}s",)", url.string().utf8().data());', '')
 
     def test_spacing_between_braces(self):
         self.assert_lint('    { }', '')
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to