diff --git a/pyproject.toml b/pyproject.toml index 992991a5e3..2e7b2d233f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -120,6 +120,7 @@ lint.select = [ "YTT", ] lint.ignore = [ + "EM101", "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` "S101", # Use of assert detected https://docs.astral.sh/ruff/rules/assert/ "SIM102", # sometimes it's better to nest diff --git a/scripts/node_version.py b/scripts/node_version.py index 6264f8ee69..a4a49218f8 100644 --- a/scripts/node_version.py +++ b/scripts/node_version.py @@ -8,6 +8,11 @@ CI_YML = ROOT / ".github" / "workflows" / "ci.yml" +class VersionNotFoundError(RuntimeError): + def __init__(self): + super().__init__("Could not find version in Dockerfile") + + def main(): new_version = get_version_from_dockerfile() old_version = get_version_from_package_json() @@ -26,6 +31,7 @@ def get_version_from_dockerfile(): _, _, docker_tag = line.partition(":") version_str, _, _ = docker_tag.partition("-") return version_str + raise VersionNotFoundError def get_version_from_package_json(): diff --git a/scripts/ruff_version.py b/scripts/ruff_version.py index b90ad523a5..cab62b47d7 100644 --- a/scripts/ruff_version.py +++ b/scripts/ruff_version.py @@ -10,6 +10,11 @@ PYPROJECT_TOML = ROOT / "pyproject.toml" +class VersionNotFoundError(RuntimeError): + def __init__(self, filename): + super().__init__(f"Could not find version in {filename}") + + def main(): new_version = get_requirements_txt_version() old_version = get_pyproject_toml_version() @@ -17,7 +22,7 @@ def main(): return update_ruff_version(old_version, new_version) - subprocess.run(["uv", "lock", "--no-upgrade"], cwd=ROOT, check=False) + subprocess.run(["uv", "lock", "--no-upgrade"], cwd=ROOT, check=False) # noqa: S603,S607 def get_requirements_txt_version(): @@ -33,6 +38,7 @@ def get_pyproject_toml_version(): for dependency in data["project"]["dependencies"]: if dependency.startswith("ruff=="): return dependency.split("==")[1] + raise VersionNotFoundError("pyproject.toml") def update_ruff_version(old_version, new_version):