1 # Copyright (c) 2012 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 import os 5 import sys 6 7 8 PYLINT_BLACKLIST = [] 9 PYLINT_DISABLED_WARNINGS = ['R0923', 'R0201', 'E1101'] 10 11 12 def _CommonChecks(input_api, output_api): 13 results = [] 14 old_sys_path = sys.path 15 try: 16 sys.path = [os.path.join(os.pardir, 'telemetry')] + sys.path 17 results.extend(input_api.canned_checks.RunPylint( 18 input_api, output_api, 19 black_list=PYLINT_BLACKLIST, 20 disabled_warnings=PYLINT_DISABLED_WARNINGS)) 21 finally: 22 sys.path = old_sys_path 23 return results 24 25 26 def CheckChangeOnUpload(input_api, output_api): 27 report = [] 28 report.extend(_CommonChecks(input_api, output_api)) 29 return report 30 31 32 def CheckChangeOnCommit(input_api, output_api): 33 report = [] 34 report.extend(_CommonChecks(input_api, output_api)) 35 return report 36