Changeset 156105 in webkit
- Timestamp:
- Sep 19, 2013, 11:13:19 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/Scripts/webkitpy/style/checkers/cpp.py (modified) (2 diffs)
-
Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py (modified) (2 diffs)
-
Websites/webkit.org/ChangeLog (modified) (1 diff)
-
Websites/webkit.org/coding/coding-style.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r156100 r156105 1 2013-09-19 Dan Bernstein <mitz@apple.com> 2 3 Add a style guideline regarding spacing in range-based for loops 4 https://bugs.webkit.org/show_bug.cgi?id=121620 5 6 Reviewed by Anders Carlsson. 7 8 * Scripts/webkitpy/style/checkers/cpp.py: 9 (check_spacing): Added checking that there are spaces around the colon in a range-based for 10 loop. 11 (CppChecker): Added whitespace/colon to the categories set. 12 * Scripts/webkitpy/style/checkers/cpp_unittest.py: 13 (WebKitStyleTest.test_spacing): Added two tests for the new check. 14 1 15 2013-09-18 Sam Weinig <sam@webkit.org> 2 16 -
trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py
r155535 r156105 1908 1908 condition, rest = up_to_unmatched_closing_paren(matched.group('remainder')) 1909 1909 if condition is not None: 1910 if statement == 'for' and search(r'(?:[^ :]:[^:]|[^:]:[^ :])', condition): 1911 error(line_number, 'whitespace/colon', 4, 'Missing space around : in range-based for statement') 1910 1912 condition_match = search(r'(?P<leading>[ ]*)(?P<separator>.).*[^ ]+(?P<trailing>[ ]*)', condition) 1911 1913 if condition_match: … … 3700 3702 'whitespace/blank_line', 3701 3703 'whitespace/braces', 3704 'whitespace/colon', 3702 3705 'whitespace/comma', 3703 3706 'whitespace/comments', -
trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
r155535 r156105 3850 3850 # '') 3851 3851 3852 # 3. Place spaces between control statements and their parentheses. 3852 # 3. Place spaces around the colon in a range-based for loop. 3853 self.assert_multi_line_lint( 3854 ' for (const WTF::Vector& vector : vectors)\n' 3855 ' process(vector);\n', 3856 '') 3857 3858 self.assert_multi_line_lint( 3859 ' for (const Vector& vector: vectors)\n' 3860 ' process(vector);\n', 3861 'Missing space around : in range-based for statement [whitespace/colon] [4]') 3862 3863 # 5. Place spaces between control statements and their parentheses. 3853 3864 self.assert_multi_line_lint( 3854 3865 ' if (condition)\n' … … 3860 3871 'Missing space before ( in if( [whitespace/parens] [5]') 3861 3872 3862 # 4. Do not place spaces between a function and its parentheses,3873 # 6. Do not place spaces between a function and its parentheses, 3863 3874 # or between a parenthesis and its content. 3864 3875 self.assert_multi_line_lint( -
trunk/Websites/webkit.org/ChangeLog
r155488 r156105 1 2013-09-19 Dan Bernstein <mitz@apple.com> 2 3 Add a style guideline regarding spacing in range-based for loops 4 https://bugs.webkit.org/show_bug.cgi?id=121620 5 6 Reviewed by Anders Carlsson. 7 8 * coding/coding-style.html: Added the guideline that spaces should be placed 9 around the colon in a range-based for loop. 10 1 11 2013-09-10 Beth Dakin <bdakin@apple.com> 2 12 -
trunk/Websites/webkit.org/coding/coding-style.html
r138068 r156105 186 186 c = a|b; 187 187 return condition ? 1:0; 188 </pre> 189 </li> 190 191 <li id="spacing-for-colon">Place spaces around the colon in a range-based for loop. 192 <h4 class="right">Right:</h4> 193 <pre class="code"> 194 Vector<PluginModuleInfo> plugins; 195 for (const auto& plugin : plugins) 196 registerPlugin(plugin); 197 </pre> 198 199 <h4 class="wrong">Wrong:</h4> 200 <pre class="code"> 201 Vector<PluginModuleInfo> plugins; 202 for (const auto& plugin: plugins) 203 registerPlugin(plugin); 188 204 </pre> 189 205 </li>
Note:
See TracChangeset
for help on using the changeset viewer.