Commit d1194266 authored by hamaji@chromium.org's avatar hamaji@chromium.org

2010-02-17 Shinichiro Hamaji <hamaji@chromium.org>

        Reviewed by Eric Seidel.

        check-webkit-style should report the number of files checked
        https://bugs.webkit.org/show_bug.cgi?id=34971

        * Scripts/check-webkit-style:
        * Scripts/webkitpy/style/checker.py:
        * Scripts/webkitpy/style/checker_unittest.py:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54917 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3a361eab
2010-02-17 Shinichiro Hamaji <hamaji@chromium.org>
Reviewed by Eric Seidel.
check-webkit-style should report the number of files checked
https://bugs.webkit.org/show_bug.cgi?id=34971
* Scripts/check-webkit-style:
* Scripts/webkitpy/style/checker.py:
* Scripts/webkitpy/style/checker_unittest.py:
2010-02-17 Diego Gonzalez <diego.gonzalez@openbossa.org>
Reviewed by Ariya Hidayat.
......
......@@ -85,8 +85,11 @@ def main():
style_checker.check_patch(patch)
error_count = style_checker.error_count
sys.stderr.write('Total errors found: %d\n' % error_count)
sys.exit(error_count > 0)
file_count = style_checker.file_count
sys.stderr.write('Total errors found: %d in %d files\n'
% (error_count, file_count))
# We fail when style errors are found or there are no checked files.
sys.exit(error_count > 0 or file_count == 0)
if __name__ == "__main__":
......
......@@ -703,6 +703,9 @@ class StyleChecker(object):
instance.
options: A ProcessorOptions instance that controls the behavior
of style checking.
file_count: An integer that is the total number of processed
files. Note that the number of skipped files is
included in this value.
"""
......@@ -723,6 +726,7 @@ class StyleChecker(object):
self._stderr_write = stderr_write
self.error_count = 0
self.options = options
self.file_count = 0
def _increment_error_count(self):
"""Increment the total count of reported errors."""
......@@ -795,6 +799,8 @@ class StyleChecker(object):
if process_file is None:
process_file = self._process_file
self.file_count += 1
dispatcher = ProcessorDispatcher()
if dispatcher.should_skip_without_warning(file_path):
......@@ -829,4 +835,3 @@ class StyleChecker(object):
self._stderr_write)
self.check_file(file_path, style_error_handler)
......@@ -569,6 +569,7 @@ class StyleCheckerTest(unittest.TestCase):
self.assertEquals(style_checker.error_count, 0)
self.assertEquals(style_checker.options, options)
self.assertEquals(style_checker.file_count, 0)
class StyleCheckerCheckFileTest(unittest.TestCase):
......@@ -649,6 +650,8 @@ class StyleCheckerCheckFileTest(unittest.TestCase):
self.mock_handle_style_error,
self.mock_process_file)
self.assertEquals(1, style_checker.file_count)
def test_check_file_on_skip_without_warning(self):
"""Test check_file() for a skipped-without-warning file."""
......@@ -704,4 +707,3 @@ if __name__ == '__main__':
import sys
unittest.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment