run_tests: integrate pylint Since we run this during `repo upload`, integrate it into CI too. And then fix the latest pylint errors that have slipped in. Bug: None Test: `./run_tests` Change-Id: I114f831b272b02424396fccf49878fd55446768d Reviewed-on: https://gerrit-review.googlesource.com/c/git-repohooks/+/556726 Reviewed-by: Raul Rangel <rrangel@google.com> Tested-by: Mike Frysinger <vapier@google.com> Commit-Queue: Mike Frysinger <vapier@google.com>
diff --git a/run_tests b/run_tests index 348f8ec..742a222 100755 --- a/run_tests +++ b/run_tests
@@ -76,11 +76,38 @@ ).returncode +def run_pylint() -> int: + """Returns the exit code from pylint.""" + argv = ["--version"] + log_cmd("pylint", argv) + subprocess.run( + [sys.executable, "-m", "pylint"] + argv, + check=True, + cwd=ROOT_DIR, + ) + + argv = [ + "--rc-file=tools/pylintrc", + "pre-upload.py", + "run_tests", + "rh/*.py", + "tools/*.py", + "tools/cpplint.py-update", + ] + log_cmd("pylint", argv) + return subprocess.run( + [sys.executable, "-m", "pylint"] + argv, + check=False, + cwd=ROOT_DIR, + ).returncode + + def main(argv): """The main entry.""" checks = ( functools.partial(run_pytest, argv), run_black, + run_pylint, ) # Run all the tests all the time to get full feedback. Don't exit on the # first error as that makes it more difficult to iterate in the CQ.
diff --git a/run_tests.vpython3 b/run_tests.vpython3 index 878e36a..dd3f4df 100644 --- a/run_tests.vpython3 +++ b/run_tests.vpython3
@@ -99,3 +99,32 @@ name: "infra/python/wheels/isort-py3" version: "version:5.10.1" > + +wheel: < + name: "infra/python/wheels/pylint-py3" + version: "version:3.2.7" +> + +# Required by pylint==3.2.7 +wheel: < + name: "infra/python/wheels/astroid-py3" + version: "version:3.2.4" +> + +# Required by pylint==3.2.7 +wheel: < + name: "infra/python/wheels/mccabe-py3" + version: "version:0.6.1" +> + +# Required by pylint==3.2.7 +wheel: < + name: "infra/python/wheels/tomlkit-py3" + version: "version:0.12.3" +> + +# Required by pylint==3.2.7 +wheel: < + name: "infra/python/wheels/dill-py3" + version: "version:0.3.7" +>