Changeset 244688 in webkit
- Timestamp:
- Apr 26, 2019 9:25:27 AM (5 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r244687 r244688 1 2019-04-26 Yoshiaki Jitsukawa <yoshiaki.jitsukawa@sony.com> 2 3 check-webkit-style complains the first block in while loop. 4 https://bugs.webkit.org/show_bug.cgi?id=197307 5 6 The style checker shouldn't complain about an open brace on 7 its own line if the last non-whitespace character on the previous 8 non-blank line is another open brace, because it's likely to 9 indicate the begining of a nested code block. 10 11 Reviewed by Alex Christensen. 12 13 * Scripts/webkitpy/style/checkers/cpp.py: 14 (check_braces): 15 * Scripts/webkitpy/style/checkers/cpp_unittest.py: 16 (WebKitStyleTest.test_braces): 17 1 18 2019-04-26 Sihui Liu <sihui_liu@apple.com> 2 19 -
trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py
r243863 r244688 2514 2514 # We also allow '#' for #endif and '=' for array initialization, 2515 2515 # and '- (' and '+ (' for Objective-C methods. 2516 # Also we don't complain if the last non-whitespace character 2517 # on the previous non-blank line is '{' because it's likely to 2518 # indicate the begining of a nested code block. 2516 2519 previous_line = get_previous_non_blank_line(clean_lines, line_number)[0] 2517 2520 if ((not search(r'[;:}{)=]\s*$|\)\s*((const|override|const override|final|const final)\s*)?(->\s*\S+)?\s*$', previous_line) … … 2520 2523 and previous_line.find('#') < 0 2521 2524 and previous_line.find('- (') != 0 2522 and previous_line.find('+ (') != 0): 2525 and previous_line.find('+ (') != 0 2526 and not search(r'{\s*$', previous_line)): 2523 2527 error(line_number, 'whitespace/braces', 4, 2524 2528 'This { should be at the end of the previous line') -
trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
r243411 r244688 4892 4892 ' }\n', 4893 4893 '') 4894 # 6. An open brace on its own line for a nested code block should be allowed. 4895 self.assert_multi_line_lint( 4896 ' if (condition) {\n' 4897 ' {\n' 4898 ' j = 1;\n' 4899 ' }\n' 4900 ' }\n', 4901 '') 4902 self.assert_multi_line_lint( 4903 ' if (condition1\n' 4904 ' || condition2\n' 4905 ' && condition3) {\n' 4906 ' {\n' 4907 ' j = 1;\n' 4908 ' }\n' 4909 ' }\n', 4910 '') 4894 4911 4895 4912 def test_null_false_zero(self):
Note: See TracChangeset
for help on using the changeset viewer.