summaryrefslogtreecommitdiffstats
path: root/WebKitTools/Scripts/check-webkit-style
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-05-11 18:35:50 +0100
committerBen Murdoch <benm@google.com>2010-05-14 10:23:05 +0100
commit21939df44de1705786c545cd1bf519d47250322d (patch)
treeef56c310f5c0cdc379c2abb2e212308a3281ce20 /WebKitTools/Scripts/check-webkit-style
parent4ff1d8891d520763f17675827154340c7c740f90 (diff)
downloadexternal_webkit-21939df44de1705786c545cd1bf519d47250322d.zip
external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.gz
external_webkit-21939df44de1705786c545cd1bf519d47250322d.tar.bz2
Merge Webkit at r58956: Initial merge by Git.
Change-Id: I1d9fb60ea2c3f2ddc04c17a871acdb39353be228
Diffstat (limited to 'WebKitTools/Scripts/check-webkit-style')
-rwxr-xr-xWebKitTools/Scripts/check-webkit-style41
1 files changed, 22 insertions, 19 deletions
diff --git a/WebKitTools/Scripts/check-webkit-style b/WebKitTools/Scripts/check-webkit-style
index 9897fbd..f74c3bd 100755
--- a/WebKitTools/Scripts/check-webkit-style
+++ b/WebKitTools/Scripts/check-webkit-style
@@ -50,7 +50,9 @@ import sys
from webkitpy.style_references import detect_checkout
import webkitpy.style.checker as checker
-from webkitpy.style.checker import PatchChecker
+from webkitpy.style.checker import PatchReader
+from webkitpy.style.checker import StyleProcessor
+from webkitpy.style.filereader import TextFileReader
from webkitpy.style.main import change_directory
_log = logging.getLogger("check-webkit-style")
@@ -84,41 +86,42 @@ def main():
checker.configure_logging(stream=stderr, is_verbose=is_verbose)
_log.debug("Verbose logging enabled.")
+ parser = checker.check_webkit_style_parser()
+ (paths, options) = parser.parse(args)
+
checkout = detect_checkout()
if checkout is None:
+ if not paths:
+ _log.error("WebKit checkout not found: You must run this script "
+ "from within a WebKit checkout if you are not passing "
+ "specific paths to check.")
+ sys.exit(1)
+
checkout_root = None
_log.debug("WebKit checkout not found for current directory.")
else:
checkout_root = checkout.root_path()
_log.debug("WebKit checkout found with root: %s" % checkout_root)
- parser = checker.check_webkit_style_parser()
- (paths, options) = parser.parse(args)
-
- if checkout is None and not paths:
- _log.error("WebKit checkout not found: You must run this script "
- "from within a WebKit checkout if you are not passing "
- "specific paths to check.")
- sys.exit(1)
-
configuration = checker.check_webkit_style_configuration(options)
- style_checker = checker.StyleChecker(configuration)
paths = change_directory(checkout_root=checkout_root, paths=paths)
+ style_processor = StyleProcessor(configuration)
+
+ file_reader = TextFileReader(style_processor)
+
if paths:
- style_checker.check_paths(paths)
+ file_reader.process_paths(paths)
else:
- if options.git_commit:
- patch = checkout.create_patch_since_local_commit(options.git_commit)
- else:
- patch = checkout.create_patch()
- patch_checker = PatchChecker(style_checker)
+ patch = checkout.create_patch(options.git_commit, options.squash)
+ patch_checker = PatchReader(file_reader)
patch_checker.check(patch)
- error_count = style_checker.error_count
- file_count = style_checker.file_count
+ error_count = style_processor.error_count
+ file_count = file_reader.file_count
+
_log.info("Total errors found: %d in %d files"
% (error_count, file_count))
# We fail when style errors are found or there are no checked files.