| # Copyright 2015 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| """Top-level presubmit script for src/components/cronet. |
| |
| See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| for more details about the presubmit API built into depot_tools. |
| """ |
| |
| import os |
| |
| PRESUBMIT_VERSION = '2.0.0' |
| |
| # Avoid importing modules by modifying sys.path. This causes side effects that |
| # prevent other PRESUBMIT.py scripts from correctly resolving their dependencies. |
| # Reference: crbug.com/478930205 - https://ci.chromium.org/ui/p/chromium/builders/ci/linux-presubmit/36616/overview |
| |
| |
| def CheckPyLint(input_api, output_api): |
| if not input_api.HasAffectedFiles(extensions='.py'): |
| return [] |
| disabled_warnings = [ |
| # TODO(crbug.com/413421824): Burn down this list over time. |
| 'anomalous-backslash-in-string', |
| 'consider-using-from-import', |
| 'consider-using-in', |
| 'consider-using-with', |
| 'deprecated-module', |
| 'line-too-long', |
| 'missing-module-docstring', |
| 'possibly-used-before-assignment', |
| 'protected-access', |
| 'superfluous-parens', |
| 'unbalanced-tuple-unpacking', |
| 'undefined-variable', |
| 'unnecessary-lambda-assignment', |
| 'unspecified-encoding', |
| 'unused-import', |
| 'use-dict-literal', |
| 'use-list-literal', |
| ] |
| return input_api.RunTests( |
| input_api.canned_checks.GetPylint(input_api, |
| output_api, |
| disabled_warnings=disabled_warnings, |
| version='3.2')) |
| |
| |
| def CheckChangeFormatted(input_api, output_api): |
| return [ |
| *input_api.canned_checks.CheckPatchFormatted( |
| input_api, |
| output_api, |
| check_python=True, |
| result_factory=output_api.PresubmitError), |
| *input_api.canned_checks.CheckGNFormatted(input_api, output_api) |
| ] |