Changeset 64743 in webkit
- Timestamp:
- Aug 5, 2010 6:41:17 AM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r64729 r64743 1 2010-08-05 Kenichi Ishibashi <bashi@google.com> 2 3 Reviewed by Shinichiro Hamaji. 4 5 check-webkit-style returns non-zero when patch is entirely minus lines. 6 https://bugs.webkit.org/show_bug.cgi?id=38169 7 8 * Scripts/check-webkit-style: 9 Check whether a patch contains modified files that are entirely minus lines. 10 * Scripts/webkitpy/style/filereader.py: 11 Add a variable that holds number of files that contain only deleted lines. 12 * Scripts/webkitpy/style/patchreader.py: 13 Count up modified files that contain only deleted lines. 14 1 15 2010-08-05 Pavel Feldman <pfeldman@chromium.org> 2 16 -
trunk/WebKitTools/Scripts/check-webkit-style
r63004 r64743 122 122 error_count = style_processor.error_count 123 123 file_count = file_reader.file_count 124 delete_only_file_count = file_reader.delete_only_file_count 124 125 125 126 _log.info("Total errors found: %d in %d files" 126 127 % (error_count, file_count)) 127 128 # We fail when style errors are found or there are no checked files. 128 sys.exit(error_count > 0 or file_count == 0)129 sys.exit(error_count > 0 or (file_count == 0 and delete_only_file_count == 0)) 129 130 130 131 -
trunk/WebKitTools/Scripts/webkitpy/style/filereader.py
r58249 r64743 48 48 for processing, including non-text files and files 49 49 that should be skipped. 50 delete_only_file_count: The total number of files that are not 51 processed this instance actually because 52 the files don't have any modified lines 53 but should be treated as processed. 50 54 51 55 """ … … 60 64 self._processor = processor 61 65 self.file_count = 0 66 self.delete_only_file_count = 0 62 67 63 68 def _read_lines(self, file_path): … … 147 152 else: 148 153 self.process_file(path) 154 155 def count_delete_only_file(self): 156 """Count up files that contains only deleted lines. 157 158 Files which has no modified or newly-added lines don't need 159 to check style, but should be treated as checked. For that 160 purpose, we just count up the number of such files. 161 """ 162 self.delete_only_file_count += 1 -
trunk/WebKitTools/Scripts/webkitpy/style/filereader_unittest.py
r58249 r64743 160 160 (['foo'], file_path1, None)] 161 161 self._assert_file_reader(processed, 2) 162 163 def test_count_delete_only_file(self): 164 self._file_reader.count_delete_only_file() 165 delete_only_file_count = self._file_reader.delete_only_file_count 166 self.assertEquals(delete_only_file_count, 1) -
trunk/WebKitTools/Scripts/webkitpy/style/patchreader.py
r60053 r64743 74 74 self._text_file_reader.process_file(file_path=path, 75 75 line_numbers=line_numbers) 76 else: 77 # We don't check the file which contains deleted lines only 78 # but would like to treat it as to be processed so that 79 # we count up number of such files. 80 self._text_file_reader.count_delete_only_file() -
trunk/WebKitTools/Scripts/webkitpy/style/patchreader_unittest.py
r60053 r64743 46 46 self.passed_to_process_file = [] 47 47 """A list of (file_path, line_numbers) pairs.""" 48 self.delete_only_file_count = 0 49 """A number of times count_delete_only_file() called""" 48 50 49 51 def process_file(self, file_path, line_numbers): 50 52 self.passed_to_process_file.append((file_path, line_numbers)) 53 54 def count_delete_only_file(self): 55 self.delete_only_file_count += 1 51 56 52 57 def setUp(self): … … 58 63 self._patch_checker.check(patch_string) 59 64 60 def _assert_checked(self, passed_to_process_file ):65 def _assert_checked(self, passed_to_process_file, delete_only_file_count): 61 66 self.assertEquals(self._file_reader.passed_to_process_file, 62 67 passed_to_process_file) 68 self.assertEquals(self._file_reader.delete_only_file_count, 69 delete_only_file_count) 63 70 64 71 def test_check_patch(self): … … 72 79 +# New line 73 80 """) 74 self._assert_checked([("__init__.py", set([2]))] )81 self._assert_checked([("__init__.py", set([2]))], 0) 75 82 76 83 def test_check_patch_with_deletion(self): … … 83 90 """) 84 91 # _mock_check_file should not be called for the deletion patch. 85 self._assert_checked([] )92 self._assert_checked([], 1)
Note: See TracChangeset
for help on using the changeset viewer.