diff --git a/.editorconfig b/.editorconfig index 6a9a5c45d..d8719a1e5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,7 +12,7 @@ trim_trailing_whitespace = true indent_style = space indent_size = 4 -[*.{html,css,scss,json,yml,xml}] +[*.{html,css,scss,json,yml,xml,toml}] indent_style = space indent_size = 2 diff --git a/scripts/ruff_version.py b/scripts/ruff_version.py index ca12be7e6..e280cef42 100644 --- a/scripts/ruff_version.py +++ b/scripts/ruff_version.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import subprocess from pathlib import Path @@ -10,7 +12,7 @@ PRE_COMMIT_CONFIG = TEMPLATED_ROOT / ".pre-commit-config.yaml" PYPROJECT_TOML = ROOT / "pyproject.toml" -def main(): +def main() -> None: new_version = get_requirements_txt_version() old_version = get_pyproject_toml_version() if old_version == new_version: @@ -20,23 +22,23 @@ def main(): subprocess.run(["uv", "lock", "--no-upgrade"], cwd=ROOT, check=False) # noqa: S603,S607 -def get_requirements_txt_version(): +def get_requirements_txt_version() -> str: content = REQUIREMENTS_LOCAL_TXT.read_text() for line in content.split("\n"): if line.startswith("ruff"): return line.split(" ")[0].split("==")[1] - return None + raise RuntimeError("Could not find ruff version in requirements/local.txt") -def get_pyproject_toml_version(): +def get_pyproject_toml_version() -> str: data = tomllib.loads(PYPROJECT_TOML.read_text()) for dependency in data["project"]["dependencies"]: if dependency.startswith("ruff=="): return dependency.split("==")[1] - raise RuntimeError("Could not find version in pyproject.toml") + raise RuntimeError("Could not find ruff version in pyproject.toml") -def update_ruff_version(old_version, new_version): +def update_ruff_version(old_version: str, new_version: str) -> None: # Update pyproject.toml new_content = PYPROJECT_TOML.read_text().replace( f"ruff=={old_version}",