Changeset 64743 in webkit


Ignore:
Timestamp:
Aug 5, 2010 6:41:17 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-08-05 Kenichi Ishibashi <bashi@google.com>

Reviewed by Shinichiro Hamaji.

check-webkit-style returns non-zero when patch is entirely minus lines.
https://bugs.webkit.org/show_bug.cgi?id=38169

  • Scripts/check-webkit-style: Check whether a patch contains modified files that are entirely minus lines.
  • Scripts/webkitpy/style/filereader.py: Add a variable that holds number of files that contain only deleted lines.
  • Scripts/webkitpy/style/patchreader.py: Count up modified files that contain only deleted lines.
Location:
trunk/WebKitTools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r64729 r64743  
     12010-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
    1152010-08-05  Pavel Feldman  <pfeldman@chromium.org>
    216
  • trunk/WebKitTools/Scripts/check-webkit-style

    r63004 r64743  
    122122    error_count = style_processor.error_count
    123123    file_count = file_reader.file_count
     124    delete_only_file_count = file_reader.delete_only_file_count
    124125
    125126    _log.info("Total errors found: %d in %d files"
    126127              % (error_count, file_count))
    127128    # 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))
    129130
    130131
  • trunk/WebKitTools/Scripts/webkitpy/style/filereader.py

    r58249 r64743  
    4848                     for processing, including non-text files and files
    4949                     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.
    5054
    5155    """
     
    6064        self._processor = processor
    6165        self.file_count = 0
     66        self.delete_only_file_count = 0
    6267
    6368    def _read_lines(self, file_path):
     
    147152            else:
    148153                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  
    160160                     (['foo'], file_path1, None)]
    161161        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  
    7474                self._text_file_reader.process_file(file_path=path,
    7575                                                    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  
    4646            self.passed_to_process_file = []
    4747            """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"""
    4850
    4951        def process_file(self, file_path, line_numbers):
    5052            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
    5156
    5257    def setUp(self):
     
    5863        self._patch_checker.check(patch_string)
    5964
    60     def _assert_checked(self, passed_to_process_file):
     65    def _assert_checked(self, passed_to_process_file, delete_only_file_count):
    6166        self.assertEquals(self._file_reader.passed_to_process_file,
    6267                          passed_to_process_file)
     68        self.assertEquals(self._file_reader.delete_only_file_count,
     69                          delete_only_file_count)
    6370
    6471    def test_check_patch(self):
     
    7279+# New line
    7380""")
    74         self._assert_checked([("__init__.py", set([2]))])
     81        self._assert_checked([("__init__.py", set([2]))], 0)
    7582
    7683    def test_check_patch_with_deletion(self):
     
    8390""")
    8491        # _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.