WebKit Bugzilla
Attachment 368316 Details for
Bug 197307
: check-webkit-style complains the first block in while loop.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-197307-20190426222152.patch (text/plain), 3.83 KB, created by
Yoshiaki Jitsukawa
on 2019-04-26 06:21:59 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Yoshiaki Jitsukawa
Created:
2019-04-26 06:21:59 PDT
Size:
3.83 KB
patch
obsolete
>Subversion Revision: 244683 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 0de37da93985c630f606c2b53eb6427bd831fd93..f68ab21526f18797b6392ba0245b511a7f74e525 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,20 @@ >+2019-04-26 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com> >+ >+ check-webkit-style complains the first block in while loop. >+ https://bugs.webkit.org/show_bug.cgi?id=197307 >+ >+ The style checker shouldn't complain about an open brace on >+ its own line if the last non-whitespace character on the previous >+ non-blank line is another open brace, because it's likely to >+ indicate the begining of a nested code block. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Scripts/webkitpy/style/checkers/cpp.py: >+ (check_braces): >+ * Scripts/webkitpy/style/checkers/cpp_unittest.py: >+ (WebKitStyleTest.test_braces): >+ > 2019-04-25 Simon Fraser <simon.fraser@apple.com> > > REGRESSION (r234330): 3 legacy-animation-engine/compositing tests are flaky failures >diff --git a/Tools/Scripts/webkitpy/style/checkers/cpp.py b/Tools/Scripts/webkitpy/style/checkers/cpp.py >index a1972205b4d0e13a8f86cbd06b0d81c8a2750e2f..4adde7aaf26bd5854862ef7dac5cd1fc35ec7b41 100644 >--- a/Tools/Scripts/webkitpy/style/checkers/cpp.py >+++ b/Tools/Scripts/webkitpy/style/checkers/cpp.py >@@ -2513,13 +2513,17 @@ def check_braces(clean_lines, line_number, file_state, error): > # ')', or ') const' and doesn't begin with 'if|for|while|switch|else'. > # We also allow '#' for #endif and '=' for array initialization, > # and '- (' and '+ (' for Objective-C methods. >+ # Also we don't complain if the last non-whitespace character >+ # on the previous non-blank line is '{' because it's likely to >+ # indicate the begining of a nested code block. > previous_line = get_previous_non_blank_line(clean_lines, line_number)[0] > if ((not search(r'[;:}{)=]\s*$|\)\s*((const|override|const override|final|const final)\s*)?(->\s*\S+)?\s*$', previous_line) > or search(r'\b(if|for|while|switch|else|CF_OPTIONS|NS_ENUM|NS_ERROR_ENUM|NS_OPTIONS)\b', previous_line) > or regex_for_lambdas_and_blocks(previous_line, line_number, file_state, error)) > and previous_line.find('#') < 0 > and previous_line.find('- (') != 0 >- and previous_line.find('+ (') != 0): >+ and previous_line.find('+ (') != 0 >+ and not search(r'{\s*$', previous_line)): > error(line_number, 'whitespace/braces', 4, > 'This { should be at the end of the previous line') > elif (search(r'\)\s*(((const|override|final)\s*)*\s*)?{\s*$', line) >diff --git a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py >index ec78b8eb31ed8b513d1d8b666c3b984619fb7db2..f8397e4e62e11b267c74a2a4ff6153448be7e384 100644 >--- a/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py >+++ b/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py >@@ -4891,6 +4891,23 @@ class WebKitStyleTest(CppStyleTestBase): > ' reallyLongParam5);\n' > ' }\n', > '') >+ # 6. An open brace on its own line for a nested code block should be allowed. >+ self.assert_multi_line_lint( >+ ' if (condition) {\n' >+ ' {\n' >+ ' j = 1;\n' >+ ' }\n' >+ ' }\n', >+ '') >+ self.assert_multi_line_lint( >+ ' if (condition1\n' >+ ' || condition2\n' >+ ' && condition3) {\n' >+ ' {\n' >+ ' j = 1;\n' >+ ' }\n' >+ ' }\n', >+ '') > > def test_null_false_zero(self): > # 1. In C++, the null pointer value should be written as nullptr. In C,
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 197307
:
368304
|
368315
| 368316