1*9c5db199SXin Li# Copyright 2020 The Chromium OS Authors. All rights reserved. 2*9c5db199SXin Li# Use of this source code is governed by a BSD-style license that can be 3*9c5db199SXin Li# found in the LICENSE file. 4*9c5db199SXin Li 5*9c5db199SXin Li 6*9c5db199SXin Lidef CommonChecks(input_api, output_api): 7*9c5db199SXin Li """Check common to presubmit / preupload.""" 8*9c5db199SXin Li results = [] 9*9c5db199SXin Li 10*9c5db199SXin Li # Python formatting issues are errors. 11*9c5db199SXin Li results += input_api.canned_checks.CheckPatchFormatted( 12*9c5db199SXin Li input_api, 13*9c5db199SXin Li output_api, 14*9c5db199SXin Li # Setting check_python=None ensures that only files with a 15*9c5db199SXin Li # .style.yapf in a parent directory are checked. This effectively 16*9c5db199SXin Li # skips most of the legacy autotest codebase that is very poorly 17*9c5db199SXin Li # formatted. 18*9c5db199SXin Li check_python=None, 19*9c5db199SXin Li check_clang_format=False, 20*9c5db199SXin Li result_factory=output_api.PresubmitError) 21*9c5db199SXin Li return results 22*9c5db199SXin Li 23*9c5db199SXin Li 24*9c5db199SXin LiCheckChangeOnUpload = CommonChecks 25*9c5db199SXin LiCheckChangeOnCommit = CommonChecks 26