File: PRESUBMIT.py

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (73 lines) | stat: -rw-r--r-- 2,144 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Copyright 2012 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""Presubmit script for changes affecting tools/json_schema_compiler/

See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built into depot_tools.
"""

import sys

PRESUBMIT_VERSION = '2.0.0'
TEST_FILE_PATTERN = [r'.+_test.py$']
# TODO(crbug.com/359623676): Fix the lint errors in these files and remove them
# from the list.
PYLINT_FILES_TO_SKIP = [
    'code_util.py',
    'compiler.py',
    'cpp_generator.py',
    'cpp_namespace_environment.py',
    'cpp_bundle_generator.py',
    'cpp_type_generator.py',
    'cpp_type_generator_test.py',
    'cc_generator.py',
    'features_cc_generator.py',
    'features_compiler.py',
    'features_h_generator.py',
    'highlighters/hilite_me_highlighter.py',
    'highlighters/none_highlighter.py',
    'highlighters/pygments_highlighter.py',
    'generate_all_externs.py',
    'feature_compiler.py',
    'h_generator.py',
    'js_externs_generator.py',
    'idl_schema.py',
    'json_schema.py',
    'js_interface_generator.py',
    'js_util.py',
    'namespace_resolver.py',
    'schema_loader.py',
    'model.py',
    'util_cc_helper.py',
    'idl_schema_test.py',
    'ts_definition_generator.py',
    'preview.py',
]


def CheckExterns(input_api, output_api):
  """Make sure tool changes update the generated externs."""
  original_sys_path = sys.path
  try:
    sys.path.insert(0, input_api.PresubmitLocalPath())
    # pylint: disable=import-outside-toplevel
    from generate_all_externs import Generate
    # pylint: enable=import-outside-toplevel
  finally:
    sys.path = original_sys_path

  return Generate(input_api, output_api, dryrun=True)


def CheckPylint(input_api, output_api):
  return input_api.canned_checks.RunPylint(
      input_api, output_api, version='2.7', files_to_skip=PYLINT_FILES_TO_SKIP
  )


def CheckTests(input_api, output_api):
  return input_api.canned_checks.RunUnitTestsInDirectory(
      input_api, output_api, '.', files_to_check=TEST_FILE_PATTERN
  )