Changeset 173174 in webkit
- Timestamp:
- Sep 2, 2014 9:03:41 AM (10 years ago)
- Location:
- trunk/Tools
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r173170 r173174 1 2014-09-02 Renato Nagy <rnagy@inf.u-szeged.hu> 2 3 check-webkit-style should complain about C++ comments in Platform.h 4 https://bugs.webkit.org/show_bug.cgi?id=133802 5 6 Reviewed by Csaba Osztrogonác. 7 8 * Scripts/webkitpy/style/checkers/cpp.py: 9 (check_platformh_comments): 10 (_process_lines): 11 (CppChecker): 12 * Scripts/webkitpy/style/checkers/cpp_unittest.py: 13 (CppStyleTest.test_platformh_comment): 14 1 15 2014-09-02 Brendan Long <self@brendanlong.com> 2 16 -
trunk/Tools/Scripts/webkitpy/style/checkers/cpp.py
r171088 r173174 3684 3684 3685 3685 3686 def check_platformh_comments(lines, error): 3687 for line_number, line in enumerate(lines): 3688 if line_number not in (0, len(lines) - 1): 3689 if line.find("//") != -1: 3690 error(line_number, 'build/cpp_comment', 5, 'CPP comments are not allowed in Platform.h, ' 3691 'please use C comments /* ... */') 3692 3686 3693 def process_line(filename, file_extension, 3687 3694 clean_lines, line, include_state, function_state, … … 3766 3773 if file_extension == 'h': 3767 3774 check_for_header_guard(filename, lines, error) 3775 if filename == 'Source/WTF/wtf/Platform.h': 3776 check_platformh_comments(lines, error) 3768 3777 3769 3778 remove_multi_line_comments(lines, error) … … 3812 3821 'build/using_std', 3813 3822 'build/using_namespace', 3823 'build/cpp_comment', 3814 3824 'legal/copyright', 3815 3825 'readability/braces', -
trunk/Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py
r171088 r173174 1141 1141 2, # One per line. 1142 1142 error_collector.result_list().count(multiline_string_error_message)) 1143 1144 def test_platformh_comments(self): 1145 check_platformh_message = ( 1146 'CPP comments are not allowed in Platform.h, ' 1147 'please use C comments /* ... */ [build/cpp_comment] [5]') 1148 1149 platformh_file_path = 'Source/WTF/wtf/Platform.h' 1150 1151 # CPP comment are not allowed in Platform.h header file. 1152 error_collector = ErrorCollector(self.assertTrue) 1153 self.process_file_data(platformh_file_path, 'h', 1154 ['// This is a cpp comment.'], 1155 error_collector) 1156 self.assertEqual( 1157 1, 1158 error_collector.result_list().count(check_platformh_message)) 1159 1160 # C comments are allowed in Platform.h 1161 error_collector = ErrorCollector(self.assertTrue) 1162 self.process_file_data(platformh_file_path, 'h', 1163 ['/* This is a C comment.*/'], 1164 error_collector) 1165 self.assertEqual( 1166 0, 1167 error_collector.result_list().count(check_platformh_message)) 1168 1169 platformh_file_path = 'Source/WTF/wtf/platform.h' 1170 1171 # CPP comment are allowed in other header files. 1172 error_collector = ErrorCollector(self.assertTrue) 1173 self.process_file_data(platformh_file_path, 'h', 1174 ['// This is a cpp comment.' 1175 '// The filepath is not' 1176 '// Source/WTF/wtf/Platform.h'], 1177 error_collector) 1178 self.assertEqual( 1179 0, 1180 error_collector.result_list().count(check_platformh_message)) 1143 1181 1144 1182 # Test non-explicit single-argument constructors
Note: See TracChangeset
for help on using the changeset viewer.