blob: 82e35d5585e6fdae66be7111f0b9879800a2dcb6 [file] [log] [blame]
maruelea586f32016-04-05 11:11:33 -07001# Copyright 2012 The LUCI Authors. All rights reserved.
maruelf1f5e2a2016-05-25 17:10:39 -07002# Use of this source code is governed under the Apache License, Version 2.0
3# that can be found in the LICENSE file.
maruel@chromium.orgfb155e92012-09-28 20:36:54 +00004
5"""Top-level presubmit script for swarm_client.
6
7See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
8details on the presubmit API built into gcl.
9"""
10
11def CommonChecks(input_api, output_api):
maruel@chromium.org8b056ba2012-10-16 14:04:49 +000012 import sys
Junji Watanabe38b28b02020-04-23 10:23:30 +000013
maruel@chromium.org8b056ba2012-10-16 14:04:49 +000014 def join(*args):
15 return input_api.os_path.join(input_api.PresubmitLocalPath(), *args)
maruel@chromium.orgfb155e92012-09-28 20:36:54 +000016
maruel@chromium.org8b056ba2012-10-16 14:04:49 +000017 output = []
18 sys_path_backup = sys.path
19 try:
20 sys.path = [
Junji Watanabe38b28b02020-04-23 10:23:30 +000021 input_api.PresubmitLocalPath(),
22 join('tests'),
23 join('third_party'),
maruel@chromium.org8b056ba2012-10-16 14:04:49 +000024 ] + sys.path
Junji Watanabe33f99d32020-07-01 05:46:57 +000025 block_list = list(input_api.DEFAULT_BLOCK_LIST) + [
aludwin0bafa452016-11-24 05:49:09 -080026 r'.*_pb2\.py$',
27 ]
Junji Watanabe38b28b02020-04-23 10:23:30 +000028 output.extend(
29 input_api.canned_checks.RunPylint(
Junji Watanabed7842342020-07-02 04:25:12 +000030 input_api,
31 output_api,
32 block_list=block_list,
33 pylintrc=join('../', 'pylintrc')),)
maruel@chromium.org8b056ba2012-10-16 14:04:49 +000034 finally:
35 sys.path = sys_path_backup
36
maruel@chromium.orgfb155e92012-09-28 20:36:54 +000037 return output
38
39
Marc-Antoine Ruel2673daa2017-10-27 10:38:06 -070040# pylint: disable=unused-argument
maruel@chromium.orgfb155e92012-09-28 20:36:54 +000041def CheckChangeOnUpload(input_api, output_api):
Marc-Antoine Ruel2673daa2017-10-27 10:38:06 -070042 return []
maruel@chromium.orgfb155e92012-09-28 20:36:54 +000043
44
45def CheckChangeOnCommit(input_api, output_api):
maruelea586f32016-04-05 11:11:33 -070046 return CommonChecks(input_api, output_api)