Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/test_expectations.py

Issue 2663623003: Simplify the initialization of Git objects in Host. (Closed)
Patch Set: Remove second paragraph in comment about awesome windows git hack Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 29 matching lines...) Expand all
40 40
41 categories = set(['test/expectations']) 41 categories = set(['test/expectations'])
42 42
43 def __init__(self, file_path, handle_style_error, host=None): 43 def __init__(self, file_path, handle_style_error, host=None):
44 self._file_path = file_path 44 self._file_path = file_path
45 self._handle_style_error = handle_style_error 45 self._handle_style_error = handle_style_error
46 self._tab_checker = TabChecker(file_path, handle_style_error) 46 self._tab_checker = TabChecker(file_path, handle_style_error)
47 47
48 # FIXME: host should be a required parameter, not an optional one. 48 # FIXME: host should be a required parameter, not an optional one.
49 host = host or Host() 49 host = host or Host()
50 host.initialize_scm()
51 50
52 self._port_obj = host.port_factory.get() 51 self._port_obj = host.port_factory.get()
53 52
54 # Suppress error messages of test_expectations module since they will be reported later. 53 # Suppress error messages of test_expectations module since they will be reported later.
55 log = logging.getLogger("webkitpy.layout_tests.layout_package.test_expec tations") 54 log = logging.getLogger("webkitpy.layout_tests.layout_package.test_expec tations")
56 log.setLevel(logging.CRITICAL) 55 log.setLevel(logging.CRITICAL)
57 56
58 def _handle_error_message(self, lineno, message, confidence): 57 def _handle_error_message(self, lineno, message, confidence):
59 pass 58 pass
60 59
61 def check_test_expectations(self, expectations_str, tests=None): 60 def check_test_expectations(self, expectations_str, tests=None):
62 parser = TestExpectationParser(self._port_obj, tests, is_lint_mode=True) 61 parser = TestExpectationParser(self._port_obj, tests, is_lint_mode=True)
63 expectations = parser.parse('expectations', expectations_str) 62 expectations = parser.parse('expectations', expectations_str)
64 63
65 level = 5 64 level = 5
66 for expectation_line in expectations: 65 for expectation_line in expectations:
67 for warning in expectation_line.warnings: 66 for warning in expectation_line.warnings:
68 self._handle_style_error(expectation_line.line_numbers, 'test/ex pectations', level, warning) 67 self._handle_style_error(expectation_line.line_numbers, 'test/ex pectations', level, warning)
69 68
70 def check_tabs(self, lines): 69 def check_tabs(self, lines):
71 self._tab_checker.check(lines) 70 self._tab_checker.check(lines)
72 71
73 def check(self, lines): 72 def check(self, lines):
74 expectations = '\n'.join(lines) 73 expectations = '\n'.join(lines)
75 if self._port_obj: 74 if self._port_obj:
76 self.check_test_expectations(expectations_str=expectations, tests=No ne) 75 self.check_test_expectations(expectations_str=expectations, tests=No ne)
77 76
78 # Warn tabs in lines as well 77 # Warn tabs in lines as well
79 self.check_tabs(lines) 78 self.check_tabs(lines)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698