dbeam | 229bcc24 | 2017-05-19 00:06:32 | [diff] [blame] | 1 | # Copyright 2017 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. |
| 4 | |
| 5 | |
| 6 | def _CommonChecks(input_api, output_api): |
| 7 | results = [] |
| 8 | try: |
| 9 | import sys |
dbeam | 574fe09 | 2017-05-25 00:21:34 | [diff] [blame] | 10 | old_sys_path = sys.path[:] |
dbeam | 229bcc24 | 2017-05-19 00:06:32 | [diff] [blame] | 11 | cwd = input_api.PresubmitLocalPath() |
| 12 | sys.path += [input_api.os_path.join(cwd, '..', '..', 'tools')] |
| 13 | import web_dev_style.presubmit_support |
| 14 | results += web_dev_style.presubmit_support.CheckStyle(input_api, output_api) |
| 15 | finally: |
| 16 | sys.path = old_sys_path |
| 17 | return results |
| 18 | |
| 19 | |
| 20 | def CheckChangeOnUpload(input_api, output_api): |
| 21 | return _CommonChecks(input_api, output_api) |
| 22 | |
| 23 | |
| 24 | def CheckChangeOnCommit(input_api, output_api): |
| 25 | return _CommonChecks(input_api, output_api) |