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.
8 def _CommonChecks(input_api
, output_api
):
11 # TODO(nduca): This should call update_docs.IsUpdateDocsNeeded().
12 # Disabled due to crbug.com/255326.
14 update_docs_path
= os
.path
.join(
15 input_api
.PresubmitLocalPath(), 'update_docs')
16 assert os
.path
.exists(update_docs_path
)
17 results
.append(output_api
.PresubmitError(
18 'Docs are stale. Please run:\n' +
19 '$ %s' % os
.path
.abspath(update_docs_path
)))
21 pylint_checks
= input_api
.canned_checks
.GetPylint(
22 input_api
, output_api
, black_list
=[], pylintrc
='pylintrc')
24 results
.extend(input_api
.RunTests(pylint_checks
))
27 def GetPathsToPrepend(input_api
):
28 return [input_api
.PresubmitLocalPath(),
29 os
.path
.join(input_api
.PresubmitLocalPath(), os
.path
.pardir
,
30 os
.path
.pardir
, 'third_party', 'typ')]
32 def RunWithPrependedPath(prepended_path
, fn
, *args
):
36 sys
.path
= prepended_path
+ old_path
41 def CheckChangeOnUpload(input_api
, output_api
):
44 results
.extend(_CommonChecks(input_api
, output_api
))
46 return RunWithPrependedPath(GetPathsToPrepend(input_api
), go
)
48 def CheckChangeOnCommit(input_api
, output_api
):
51 results
.extend(_CommonChecks(input_api
, output_api
))
53 return RunWithPrependedPath(GetPathsToPrepend(input_api
), go
)