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

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

Issue 2671583002: Revert of Simplify the initialization of Git objects in Host. (Closed)
Patch Set: 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()
50 51
51 self._port_obj = host.port_factory.get() 52 self._port_obj = host.port_factory.get()
52 53
53 # Suppress error messages of test_expectations module since they will be reported later. 54 # Suppress error messages of test_expectations module since they will be reported later.
54 log = logging.getLogger("webkitpy.layout_tests.layout_package.test_expec tations") 55 log = logging.getLogger("webkitpy.layout_tests.layout_package.test_expec tations")
55 log.setLevel(logging.CRITICAL) 56 log.setLevel(logging.CRITICAL)
56 57
57 def _handle_error_message(self, lineno, message, confidence): 58 def _handle_error_message(self, lineno, message, confidence):
58 pass 59 pass
59 60
60 def check_test_expectations(self, expectations_str, tests=None): 61 def check_test_expectations(self, expectations_str, tests=None):
61 parser = TestExpectationParser(self._port_obj, tests, is_lint_mode=True) 62 parser = TestExpectationParser(self._port_obj, tests, is_lint_mode=True)
62 expectations = parser.parse('expectations', expectations_str) 63 expectations = parser.parse('expectations', expectations_str)
63 64
64 level = 5 65 level = 5
65 for expectation_line in expectations: 66 for expectation_line in expectations:
66 for warning in expectation_line.warnings: 67 for warning in expectation_line.warnings:
67 self._handle_style_error(expectation_line.line_numbers, 'test/ex pectations', level, warning) 68 self._handle_style_error(expectation_line.line_numbers, 'test/ex pectations', level, warning)
68 69
69 def check_tabs(self, lines): 70 def check_tabs(self, lines):
70 self._tab_checker.check(lines) 71 self._tab_checker.check(lines)
71 72
72 def check(self, lines): 73 def check(self, lines):
73 expectations = '\n'.join(lines) 74 expectations = '\n'.join(lines)
74 if self._port_obj: 75 if self._port_obj:
75 self.check_test_expectations(expectations_str=expectations, tests=No ne) 76 self.check_test_expectations(expectations_str=expectations, tests=No ne)
76 77
77 # Warn tabs in lines as well 78 # Warn tabs in lines as well
78 self.check_tabs(lines) 79 self.check_tabs(lines)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698