Remove linters from requirements-tests.txt (#12725)

This commit is contained in:
Alex Waygood
2024-10-05 14:37:27 +01:00
committed by GitHub
parent 77510ae6a4
commit ad96829bfa
4 changed files with 13 additions and 17 deletions

View File

@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0 # must match requirements-tests.txt
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
@@ -27,16 +27,16 @@ repos:
- "--unsafe-fixes"
files: '.*test_cases/.+\.py$'
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.8.0 # must match requirements-tests.txt
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 7.1.1 # must match requirements-tests.txt
rev: 7.1.1
hooks:
- id: flake8
additional_dependencies:
- "flake8-noqa==1.4.0" # must match requirements-tests.txt
- "flake8-pyi==24.6.0" # must match requirements-tests.txt
- "flake8-noqa==1.4.0"
- "flake8-pyi==24.6.0"
types: [file]
types_or: [python, pyi]
- repo: meta

View File

@@ -1,16 +1,9 @@
# Type checkers and other linters that we test our stubs against. These should always
# be pinned to a specific version to make failure reproducible. See also the
# "tool.typeshed" section in pyproject.toml for additional type checkers.
black==24.8.0 # must match .pre-commit-config.yaml
flake8==7.1.1 # must match .pre-commit-config.yaml
flake8-noqa==1.4.0 # must match .pre-commit-config.yaml
flake8-pyi==24.6.0 # must match .pre-commit-config.yaml
# Type checkers that we test our stubs against. These should always
# be pinned to a specific version to make failure reproducible.
mypy==1.11.2
pre-commit-hooks==4.6.0 # must match .pre-commit-config.yaml
pyright==1.1.383
# pytype can be installed on Windows, but requires building wheels, let's not do that on the CI
pytype==2024.9.13; platform_system != "Windows" and python_version < "3.13"
ruff==0.6.8 # must match .pre-commit-config.yaml
# Libraries used by our various scripts.
aiohttp==3.10.8
@@ -21,6 +14,8 @@ mypy-protobuf==3.6.0
packaging==24.1
pathspec>=0.11.1
pre-commit
# Required by create_baseline_stubs.py. Must match .pre-commit-config.yaml.
ruff==0.6.8
stubdefaulter==0.1.0
termcolor>=2.3
tomli==2.0.1

View File

@@ -12,7 +12,8 @@ from __future__ import annotations
import argparse
import asyncio
import os
import glob
import os.path
import re
import subprocess
import sys
@@ -60,7 +61,7 @@ def run_stubdefaulter(stub_dir: str) -> None:
def run_black(stub_dir: str) -> None:
print(f"Running Black: black {stub_dir}")
subprocess.run(["black", stub_dir])
subprocess.run(["pre-commit", "run", "black", "--files", *glob.iglob(f"{stub_dir}/**/*.pyi")])
def run_ruff(stub_dir: str) -> None:

View File

@@ -30,7 +30,7 @@ extension_descriptions = {".pyi": "stub", ".py": ".py"}
# These type checkers and linters must have exact versions in the requirements file to ensure
# consistent CI runs.
linters = {"black", "flake8", "flake8-noqa", "flake8-pyi", "mypy", "pyright", "pytype", "ruff"}
linters = {"mypy", "pyright", "pytype", "ruff"}
def assert_consistent_filetypes(