xref: /aosp_15_r20/external/libyuv/PRESUBMIT.py (revision 4e366538070a3a6c5c163c31b791eab742e1657a)
1# Copyright 2017 The LibYuv Project Authors. All rights reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
9# Runs PRESUBMIT.py in py3 mode by git cl presubmit.
10USE_PYTHON3 = True
11
12def _CommonChecks(input_api, output_api):
13  """Checks common to both upload and commit."""
14  results = []
15  results.extend(input_api.canned_checks.RunPylint(input_api, output_api,
16      files_to_skip=(r'^base[\\\/].*\.py$',
17                     r'^build[\\\/].*\.py$',
18                     r'^buildtools[\\\/].*\.py$',
19                     r'^ios[\\\/].*\.py$',
20                     r'^out.*[\\\/].*\.py$',
21                     r'^testing[\\\/].*\.py$',
22                     r'^third_party[\\\/].*\.py$',
23                     r'^tools[\\\/].*\.py$',
24                     # TODO(kjellander): should arguably be checked.
25                     r'^tools_libyuv[\\\/]valgrind[\\\/].*\.py$',
26                     r'^xcodebuild.*[\\\/].*\.py$',),
27      disabled_warnings=['F0401',  # Failed to import x
28                         'E0611',  # No package y in x
29                         'W0232',  # Class has no __init__ method
30                        ],
31      pylintrc='pylintrc',
32      version='2.7'))
33  return results
34
35
36def CheckChangeOnUpload(input_api, output_api):
37  results = []
38  results.extend(_CommonChecks(input_api, output_api))
39  results.extend(
40      input_api.canned_checks.CheckGNFormatted(input_api, output_api))
41  return results
42
43
44def CheckChangeOnCommit(input_api, output_api):
45  results = []
46  results.extend(_CommonChecks(input_api, output_api))
47  results.extend(input_api.canned_checks.CheckOwners(input_api, output_api))
48  results.extend(input_api.canned_checks.CheckChangeWasUploaded(
49      input_api, output_api))
50  results.extend(input_api.canned_checks.CheckChangeHasDescription(
51      input_api, output_api))
52  return results
53