Enable Ruff PLW (Pylint Warning) (#13749)

This commit is contained in:
Avasam
2025-04-01 15:12:15 +02:00
committed by GitHub
parent df1206f3cb
commit eafa274f1b
14 changed files with 43 additions and 37 deletions
+9 -7
View File
@@ -76,10 +76,10 @@ def main() -> None:
pytype_result: subprocess.CompletedProcess[bytes] | None = None
print("\nRunning pre-commit...")
pre_commit_result = subprocess.run(["pre-commit", "run", "--files", *Path(path).rglob("*")])
pre_commit_result = subprocess.run(["pre-commit", "run", "--files", *Path(path).rglob("*")], check=False)
print("\nRunning check_typeshed_structure.py...")
check_structure_result = subprocess.run([sys.executable, "tests/check_typeshed_structure.py"])
check_structure_result = subprocess.run([sys.executable, "tests/check_typeshed_structure.py"], check=False)
strict_params = _get_strict_params(path)
print(f"\nRunning Pyright ({'stricter' if strict_params else 'base' } configs) for Python {python_version}...")
@@ -87,6 +87,7 @@ def main() -> None:
[sys.executable, "tests/pyright_test.py", path, "--pythonversion", python_version, *strict_params],
stderr=subprocess.PIPE,
text=True,
check=False,
)
if re.match(_NPX_ERROR_PATTERN, pyright_result.stderr):
print(_NPX_ERROR_MESSAGE)
@@ -98,16 +99,16 @@ def main() -> None:
pyright_skipped = False
print(f"\nRunning mypy for Python {python_version}...")
mypy_result = subprocess.run([sys.executable, "tests/mypy_test.py", path, "--python-version", python_version])
mypy_result = subprocess.run([sys.executable, "tests/mypy_test.py", path, "--python-version", python_version], check=False)
# If mypy failed, stubtest will fail without any helpful error
if mypy_result.returncode == 0:
if folder == "stdlib":
print("\nRunning stubtest...")
stubtest_result = subprocess.run([sys.executable, "tests/stubtest_stdlib.py", stub])
stubtest_result = subprocess.run([sys.executable, "tests/stubtest_stdlib.py", stub], check=False)
else:
if run_stubtest:
print("\nRunning stubtest...")
stubtest_result = subprocess.run([sys.executable, "tests/stubtest_third_party.py", stub])
stubtest_result = subprocess.run([sys.executable, "tests/stubtest_third_party.py", stub], check=False)
else:
print(
colored(
@@ -122,7 +123,7 @@ def main() -> None:
if find_spec("pytype"):
print("\nRunning pytype...")
pytype_result = subprocess.run([sys.executable, "tests/pytype_test.py", path])
pytype_result = subprocess.run([sys.executable, "tests/pytype_test.py", path], check=False)
else:
print(
colored(
@@ -149,7 +150,7 @@ def main() -> None:
"-p",
_TESTCASES_CONFIG_FILE,
]
pyright_testcases_result = subprocess.run(command, stderr=subprocess.PIPE, text=True)
pyright_testcases_result = subprocess.run(command, stderr=subprocess.PIPE, text=True, check=False)
if re.match(_NPX_ERROR_PATTERN, pyright_testcases_result.stderr):
print(_NPX_ERROR_MESSAGE)
pyright_testcases_returncode = 0
@@ -164,6 +165,7 @@ def main() -> None:
[sys.executable, "tests/regr_test.py", "stdlib" if folder == "stdlib" else stub, "--python-version", python_version],
stderr=subprocess.PIPE,
text=True,
check=False,
)
# No test means they all ran successfully (0 out of 0). Not all 3rd-party stubs have regression tests.
if "No test cases found" in regr_test_result.stderr: