mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 02:31:29 +00:00
Add pylint-2.7
R=apolito@google.com, dpranke@google.com Bug: 1257792 Change-Id: I61a37d4b48dde0b7e1975d95d8fd627b9cbfb65b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3214207 Commit-Queue: Josip Sokcevic <sokcevic@google.com> Reviewed-by: Dirk Pranke <dpranke@google.com>
This commit is contained in:
@@ -940,15 +940,16 @@ def GetPylint(input_api,
|
|||||||
|
|
||||||
The default files_to_check enforces looking only at *.py files.
|
The default files_to_check enforces looking only at *.py files.
|
||||||
|
|
||||||
Currently only pylint version '1.5' and '2.6' are supported.
|
Currently only pylint version '1.5', '2.6' and '2.7' are supported.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
files_to_check = tuple(files_to_check or (r'.*\.py$', ))
|
files_to_check = tuple(files_to_check or (r'.*\.py$', ))
|
||||||
files_to_skip = tuple(files_to_skip or input_api.DEFAULT_FILES_TO_SKIP)
|
files_to_skip = tuple(files_to_skip or input_api.DEFAULT_FILES_TO_SKIP)
|
||||||
extra_paths_list = extra_paths_list or []
|
extra_paths_list = extra_paths_list or []
|
||||||
|
|
||||||
assert version in ('1.5', '2.6'), 'Unsupported pylint version: ' + version
|
assert version in ('1.5', '2.6', '2.7'), \
|
||||||
python3 = (version == '2.6')
|
'Unsupported pylint version: ' + version
|
||||||
|
python2 = (version == '1.5')
|
||||||
|
|
||||||
if input_api.is_committing:
|
if input_api.is_committing:
|
||||||
error_type = output_api.PresubmitError
|
error_type = output_api.PresubmitError
|
||||||
@@ -1036,7 +1037,7 @@ def GetPylint(input_api,
|
|||||||
cmd=cmd,
|
cmd=cmd,
|
||||||
kwargs=kwargs,
|
kwargs=kwargs,
|
||||||
message=error_type,
|
message=error_type,
|
||||||
python3=python3)
|
python3=not python2)
|
||||||
|
|
||||||
# Always run pylint and pass it all the py files at once.
|
# Always run pylint and pass it all the py files at once.
|
||||||
# Passing py files one at time is slower and can produce
|
# Passing py files one at time is slower and can produce
|
||||||
|
|||||||
71
pylint-2.7
Executable file
71
pylint-2.7
Executable file
@@ -0,0 +1,71 @@
|
|||||||
|
#!/usr/bin/env vpython3
|
||||||
|
# Copyright 2019 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.
|
||||||
|
|
||||||
|
# Note: We use tags here instead of refs because refs will always hit the
|
||||||
|
# network to see if there are any updates.
|
||||||
|
|
||||||
|
# [VPYTHON:BEGIN]
|
||||||
|
# # Third party dependencies. These are only listed because pylint itself needs
|
||||||
|
# # them. Feel free to add/remove anything here.
|
||||||
|
# python_version: "3"
|
||||||
|
#
|
||||||
|
# wheel: <
|
||||||
|
# name: "infra/python/wheels/futures-py2_py3"
|
||||||
|
# version: "version:3.1.1"
|
||||||
|
# >
|
||||||
|
# wheel: <
|
||||||
|
# name: "infra/python/wheels/isort-py2_py3"
|
||||||
|
# version: "version:4.3.4"
|
||||||
|
# >
|
||||||
|
# wheel: <
|
||||||
|
# name: "infra/python/wheels/mccabe-py2_py3"
|
||||||
|
# version: "version:0.6.1"
|
||||||
|
# >
|
||||||
|
# wheel: <
|
||||||
|
# name: "infra/python/wheels/six-py2_py3"
|
||||||
|
# version: "version:1.15.0"
|
||||||
|
# >
|
||||||
|
# wheel: <
|
||||||
|
# name: "infra/python/wheels/toml-py3"
|
||||||
|
# version: "version:0.10.1"
|
||||||
|
# >
|
||||||
|
# wheel: <
|
||||||
|
# name: "infra/python/wheels/wrapt/${vpython_platform}"
|
||||||
|
# version: "version:1.12.1"
|
||||||
|
# >
|
||||||
|
# wheel: <
|
||||||
|
# name: "infra/python/wheels/lazy-object-proxy/${vpython_platform}"
|
||||||
|
# version: "version:1.4.3"
|
||||||
|
# >
|
||||||
|
# wheel: <
|
||||||
|
# name: "infra/python/wheels/colorama-py3"
|
||||||
|
# version: "version:0.4.1"
|
||||||
|
# >
|
||||||
|
#
|
||||||
|
# # Pylint extensions.
|
||||||
|
#
|
||||||
|
# wheel: <
|
||||||
|
# name: "infra/python/wheels/pylint-quotes-py3"
|
||||||
|
# version: "version:0.2.1"
|
||||||
|
# >
|
||||||
|
#
|
||||||
|
# # Pylint dependencies.
|
||||||
|
#
|
||||||
|
# wheel: <
|
||||||
|
# name: "infra/python/wheels/astroid-py3"
|
||||||
|
# version: "version:2.4.2"
|
||||||
|
# >
|
||||||
|
# wheel: <
|
||||||
|
# name: "infra/python/wheels/pylint-py3"
|
||||||
|
# version: "version:2.7.4"
|
||||||
|
# >
|
||||||
|
#
|
||||||
|
# [VPYTHON:END]
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import pylint_main
|
||||||
|
|
||||||
|
sys.exit(pylint_main.main(sys.argv[1:]))
|
||||||
12
pylint-2.7.bat
Normal file
12
pylint-2.7.bat
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
@echo off
|
||||||
|
:: Copyright 2021 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.
|
||||||
|
setlocal
|
||||||
|
|
||||||
|
:: Ensure that "depot_tools" is somewhere in PATH so this tool can be used
|
||||||
|
:: standalone, but allow other PATH manipulations to take priority.
|
||||||
|
set PATH=%PATH%;%~dp0
|
||||||
|
|
||||||
|
:: Defer control.
|
||||||
|
vpython3 "%~dp0\pylint-2.7" %*
|
||||||
Reference in New Issue
Block a user