1 # Copyright 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.
6 def _CommonChecks(input_api
, output_api
):
9 # TODO(nduca): This should call update_docs.IsUpdateDocsNeeded().
10 # Disabled due to crbug.com/255326.
12 update_docs_path
= input_api
.os_path
.join(
13 input_api
.PresubmitLocalPath(), 'update_docs')
14 assert input_api
.os_path
.exists(update_docs_path
)
15 results
.append(output_api
.PresubmitError(
16 'Docs are stale. Please run:\n' +
17 '$ %s' % input_api
.os_path
.abspath(update_docs_path
)))
19 pylint_checks
= input_api
.canned_checks
.GetPylint(
20 input_api
, output_api
, extra_paths_list
=_GetPathsToPrepend(input_api
),
23 results
.extend(input_api
.RunTests(pylint_checks
))
27 def _GetPathsToPrepend(input_api
):
28 telemetry_dir
= input_api
.PresubmitLocalPath()
29 chromium_src_dir
= input_api
.os_path
.join(telemetry_dir
, '..', '..')
32 input_api
.os_path
.join(telemetry_dir
, 'third_party', 'mock'),
33 input_api
.os_path
.join(telemetry_dir
, 'third_party', 'typ'),
34 input_api
.os_path
.join(telemetry_dir
, 'third_party', 'websocket-client'),
36 input_api
.os_path
.join(chromium_src_dir
, 'build', 'android'),
37 input_api
.os_path
.join(
38 chromium_src_dir
, 'third_party', 'py_trace_event', 'src'),
39 input_api
.os_path
.join(chromium_src_dir
, 'third_party', 'trace-viewer'),
40 input_api
.os_path
.join(chromium_src_dir
, 'third_party', 'webpagereplay'),
44 def CheckChangeOnUpload(input_api
, output_api
):
46 results
.extend(_CommonChecks(input_api
, output_api
))
50 def CheckChangeOnCommit(input_api
, output_api
):
52 results
.extend(_CommonChecks(input_api
, output_api
))