mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Add some ruff autofixes to CI (#10458)
This commit is contained in:
@@ -65,6 +65,11 @@ def run_isort(stub_dir: str) -> None:
|
||||
subprocess.run([sys.executable, "-m", "isort", stub_dir])
|
||||
|
||||
|
||||
def run_ruff(stub_dir: str) -> None:
|
||||
print(f"Running ruff: ruff {stub_dir}")
|
||||
subprocess.run([sys.executable, "-m", "ruff", stub_dir])
|
||||
|
||||
|
||||
def create_metadata(stub_dir: str, version: str) -> None:
|
||||
"""Create a METADATA.toml file."""
|
||||
match = re.match(r"[0-9]+.[0-9]+", version)
|
||||
@@ -110,7 +115,7 @@ def add_pyright_exclusion(stub_dir: str) -> None:
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(
|
||||
description="""Generate baseline stubs automatically for an installed pip package
|
||||
using stubgen. Also run black and isort. If the name of
|
||||
using stubgen. Also run black, isort and ruff. If the name of
|
||||
the project is different from the runtime Python package name, you may
|
||||
need to use --package (example: --package yaml PyYAML)."""
|
||||
)
|
||||
@@ -159,6 +164,7 @@ def main() -> None:
|
||||
run_stubgen(package, stub_dir)
|
||||
run_stubdefaulter(stub_dir)
|
||||
|
||||
run_ruff(stub_dir)
|
||||
run_isort(stub_dir)
|
||||
run_black(stub_dir)
|
||||
|
||||
|
||||
@@ -77,6 +77,8 @@ def main() -> None:
|
||||
# Run formatters first. Order matters.
|
||||
print("\nRunning pycln...")
|
||||
subprocess.run([sys.executable, "-m", "pycln", path, "--config=pyproject.toml"])
|
||||
print("\nRunning ruff...")
|
||||
subprocess.run([sys.executable, "-m", "ruff", path])
|
||||
print("\nRunning isort...")
|
||||
subprocess.run([sys.executable, "-m", "isort", path])
|
||||
print("\nRunning Black...")
|
||||
|
||||
Reference in New Issue
Block a user