1 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 6 def CheckChangeOnUpload(input_api, output_api): 7 return _CommonChecks(input_api, output_api) 8 9 10 def CheckChangeOnCommit(input_api, output_api): 11 return _CommonChecks(input_api, output_api) 12 13 14 def _CommonChecks(input_api, output_api): 15 results = [] 16 results += input_api.RunTests(input_api.canned_checks.GetPylint( 17 input_api, output_api, extra_paths_list=_GetPathsToPrepend(input_api), 18 pylintrc='pylintrc')) 19 return results 20 21 22 def _GetPathsToPrepend(input_api): 23 project_dir = input_api.PresubmitLocalPath() 24 catapult_dir = input_api.os_path.join(project_dir, '..') 25 return [ 26 project_dir, 27 28 input_api.os_path.join(catapult_dir, 'common', 'battor'), 29 input_api.os_path.join(catapult_dir, 'common', 'py_trace_event'), 30 input_api.os_path.join(catapult_dir, 'common', 'py_utils'), 31 input_api.os_path.join(catapult_dir, 'devil'), 32 input_api.os_path.join(catapult_dir, 'telemetry'), 33 input_api.os_path.join(catapult_dir, 'third_party', 'mock'), 34 input_api.os_path.join(catapult_dir, 'tracing'), 35 36 ] 37