From 9700afdd24644472ba5dabf03e059ed30a3f07b8 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Tue, 18 Feb 2025 22:28:53 +0000 Subject: [PATCH] Disable TRY003 --- pyproject.toml | 1 + scripts/create_django_issue.py | 3 +-- scripts/node_version.py | 2 +- scripts/ruff_version.py | 2 +- scripts/update_changelog.py | 6 ++---- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fefdcb4ce..28e9bb1f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -124,6 +124,7 @@ lint.ignore = [ "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 + "TRY003", # Avoid specifying long messages outside the exception class # Checks for uses of isinstance/issubclass that take a tuple of types for comparison. # Deactivated because it can make the code slow: https://github.com/astral-sh/ruff/issues/7871 "UP038", diff --git a/scripts/create_django_issue.py b/scripts/create_django_issue.py index cae69d4ef..bbc897f5c 100644 --- a/scripts/create_django_issue.py +++ b/scripts/create_django_issue.py @@ -301,8 +301,7 @@ def main(django_max_version=None) -> None: if __name__ == "__main__": if GITHUB_REPO is None: - msg = "No github repo, please set the environment variable GITHUB_REPOSITORY" - raise RuntimeError(msg) + raise RuntimeError("No github repo, please set the environment variable GITHUB_REPOSITORY") max_version = None last_arg = sys.argv[-1] if CURRENT_FILE.name not in last_arg: diff --git a/scripts/node_version.py b/scripts/node_version.py index 590ea4c1d..2fca03702 100644 --- a/scripts/node_version.py +++ b/scripts/node_version.py @@ -30,7 +30,7 @@ def get_version_from_dockerfile() -> str: _, _, docker_tag = line.partition(":") version_str, _, _ = docker_tag.partition("-") return version_str - raise RuntimeError("Could not find version in Dockerfile") # noqa: TRY003 + raise RuntimeError("Could not find version in Dockerfile") def get_version_from_package_json() -> str: diff --git a/scripts/ruff_version.py b/scripts/ruff_version.py index e0b54c9b8..ca12be7e6 100644 --- a/scripts/ruff_version.py +++ b/scripts/ruff_version.py @@ -33,7 +33,7 @@ def get_pyproject_toml_version(): for dependency in data["project"]["dependencies"]: if dependency.startswith("ruff=="): return dependency.split("==")[1] - raise RuntimeError("Could not find version in pyproject.toml") # noqa: TRY003 + raise RuntimeError("Could not find version in pyproject.toml") def update_ruff_version(old_version, new_version): diff --git a/scripts/update_changelog.py b/scripts/update_changelog.py index cc2190472..7118b5a05 100644 --- a/scripts/update_changelog.py +++ b/scripts/update_changelog.py @@ -162,9 +162,7 @@ def update_git_repo(paths: list[Path], release: str) -> None: if __name__ == "__main__": if GITHUB_REPO is None: - msg = "No github repo, please set the environment variable GITHUB_REPOSITORY" - raise RuntimeError(msg) + raise RuntimeError("No github repo, please set the environment variable GITHUB_REPOSITORY") if GIT_BRANCH is None: - msg = "No git branch set, please set the GITHUB_REF_NAME environment variable" - raise RuntimeError(msg) + raise RuntimeError("No git branch set, please set the GITHUB_REF_NAME environment variable") main()