Prathmesh Prabhu | 088771d | 2020-08-24 14:02:48 -0700 | [diff] [blame] | 1 | # Copyright 2020 The Chromium OS 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 | """Check common to presubmit / preupload.""" |
| 8 | results = [] |
| 9 | |
| 10 | # Python formatting issues are errors. |
| 11 | results += input_api.canned_checks.CheckPatchFormatted( |
| 12 | input_api, |
| 13 | output_api, |
| 14 | # Setting check_python=None ensures that only files with a |
| 15 | # .style.yapf in a parent directory are checked. This effectively |
| 16 | # skips most of the legacy autotest codebase that is very poorly |
| 17 | # formatted. |
| 18 | check_python=None, |
| 19 | check_clang_format=False, |
| 20 | result_factory=output_api.PresubmitError) |
| 21 | return results |
| 22 | |
| 23 | |
| 24 | CheckChangeOnUpload = CommonChecks |
| 25 | CheckChangeOnCommit = CommonChecks |