This repository has been archived on 2023-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
Android-Mobile-Toolkit/platform-tools/systrace/catapult/common/py_utils/PRESUBMIT.py

32 lines
1.0 KiB
Python
Raw Normal View History

2019-09-28 03:56:01 +00:00
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
def CheckChangeOnUpload(input_api, output_api):
return _CommonChecks(input_api, output_api)
def CheckChangeOnCommit(input_api, output_api):
return _CommonChecks(input_api, output_api)
def _CommonChecks(input_api, output_api):
results = []
results += input_api.RunTests(input_api.canned_checks.GetPylint(
input_api, output_api, extra_paths_list=_GetPathsToPrepend(input_api),
pylintrc='../../pylintrc'))
return results
def _GetPathsToPrepend(input_api):
project_dir = input_api.PresubmitLocalPath()
catapult_dir = input_api.os_path.join(project_dir, '..', '..')
return [
project_dir,
input_api.os_path.join(catapult_dir, 'dependency_manager'),
input_api.os_path.join(catapult_dir, 'devil'),
input_api.os_path.join(catapult_dir, 'third_party', 'mock'),
input_api.os_path.join(catapult_dir, 'third_party', 'pyfakefs'),
]