blob: 2d77fc3ce65bc915b8b1e739ec272d61eb00e5ef [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
Vadim Shtayurab3b0bad2022-10-27 17:50:40 +000011USE_PYTHON3 = True
12
13
maruel@chromium.orgfb155e92012-09-28 20:36:54 +000014def CommonChecks(input_api, output_api):
maruel@chromium.org8b056ba2012-10-16 14:04:49 +000015 import sys
Junji Watanabe38b28b02020-04-23 10:23:30 +000016
maruel@chromium.org8b056ba2012-10-16 14:04:49 +000017 def join(*args):
18 return input_api.os_path.join(input_api.PresubmitLocalPath(), *args)
maruel@chromium.orgfb155e92012-09-28 20:36:54 +000019
maruel@chromium.org8b056ba2012-10-16 14:04:49 +000020 output = []
21 sys_path_backup = sys.path
22 try:
23 sys.path = [
Junji Watanabe38b28b02020-04-23 10:23:30 +000024 input_api.PresubmitLocalPath(),
25 join('tests'),
26 join('third_party'),
maruel@chromium.org8b056ba2012-10-16 14:04:49 +000027 ] + sys.path
Junji Watanabe3ac618a2020-08-11 06:14:01 +000028 files_to_skip = list(input_api.DEFAULT_FILES_TO_SKIP) + [
aludwin0bafa452016-11-24 05:49:09 -080029 r'.*_pb2\.py$',
30 ]
Junji Watanabe38b28b02020-04-23 10:23:30 +000031 output.extend(
Junji Watanabeab2102a2022-01-12 01:44:04 +000032 input_api.canned_checks.RunPylint(input_api,
33 output_api,
34 files_to_skip=files_to_skip,
Vadim Shtayurab3b0bad2022-10-27 17:50:40 +000035 pylintrc=join('../', 'pylintrc')))
maruel@chromium.org8b056ba2012-10-16 14:04:49 +000036 finally:
37 sys.path = sys_path_backup
38
maruel@chromium.orgfb155e92012-09-28 20:36:54 +000039 return output
40
41
Marc-Antoine Ruel2673daa2017-10-27 10:38:06 -070042# pylint: disable=unused-argument
maruel@chromium.orgfb155e92012-09-28 20:36:54 +000043def CheckChangeOnUpload(input_api, output_api):
Marc-Antoine Ruel2673daa2017-10-27 10:38:06 -070044 return []
maruel@chromium.orgfb155e92012-09-28 20:36:54 +000045
46
47def CheckChangeOnCommit(input_api, output_api):
maruelea586f32016-04-05 11:11:33 -070048 return CommonChecks(input_api, output_api)