Commit 26e2c94c authored by Josip Sokcevic's avatar Josip Sokcevic Committed by LUCI CQ

Issue warnings when running pylint-1.5

Tested manually since we have no unit tests that cover this bit.

R=gavinmak@google.com

Bug: 1105747
Change-Id: I113e27236ed450490e59df9a6f698925ff556bc7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3685350Reviewed-by: 's avatarGavin Mak <gavinmak@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
parent 94d0c0e6
...@@ -1103,28 +1103,24 @@ def GetPylint(input_api, ...@@ -1103,28 +1103,24 @@ def GetPylint(input_api,
message=error_type, message=error_type,
python3=not python2) python3=not python2)
# Always run pylint and pass it all the py files at once. # pylint's cycle detection doesn't work in parallel, so spawn a second,
# Passing py files one at time is slower and can produce # single-threaded job for just that check.
# different results. input_api.verbose used to be used # Some PRESUBMITs explicitly mention cycle detection.
# to enable this behaviour but differing behaviour in if not any('R0401' in a or 'cyclic-import' in a for a in extra_args):
# verbose mode is not desirable. tests = [
# Leave this unreachable code in here so users can make GetPylintCmd(files, ["--disable=cyclic-import"], True),
# a quick local edit to diagnose pylint issues more GetPylintCmd(files, ["--disable=all", "--enable=cyclic-import"], False),
# easily. ]
if True: else:
# pylint's cycle detection doesn't work in parallel, so spawn a second, tests = [
# single-threaded job for just that check. GetPylintCmd(files, [], True),
]
# Some PRESUBMITs explicitly mention cycle detection. if version == '1.5':
if not any('R0401' in a or 'cyclic-import' in a for a in extra_args): # Warn users about pylint-1.5 deprecation
return [ tests.append(output_api.PresubmitPromptWarning(
GetPylintCmd(files, ["--disable=cyclic-import"], True), 'pylint-1.5 is deprecated, please switch to 2.7 before 2022-07-11'))
GetPylintCmd(files, ["--disable=all", "--enable=cyclic-import"], False)
]
return [ GetPylintCmd(files, [], True) ]
return map(lambda x: GetPylintCmd([x], [], 1), files) return tests
def RunPylint(input_api, *args, **kwargs): def RunPylint(input_api, *args, **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment