diff --git a/.ruff.toml b/.ruff.toml index 5adad926..b023639d 100644 --- a/.ruff.toml +++ b/.ruff.toml @@ -9,6 +9,7 @@ select = [ "COM", # flake8-commas "DTZ", # flake8-commas "E", # pycodestyle errors + "EM", # pycodestyle errors "F", # pyflakes errors "I", # isort "ISC", # flake8-implicit-str-concat diff --git a/src/common/dates.py b/src/common/dates.py index 5dfd4b82..47562703 100644 --- a/src/common/dates.py +++ b/src/common/dates.py @@ -50,7 +50,8 @@ def parse_datetime(text: str, formats: list[str] = frozenset([ except ValueError: pass - raise ValueError(f"'{text}' could not be parsed as a date with any of the formats: {str(formats)}") + msg = f"'{text}' could not be parsed as a date with any of the formats: {str(formats)}" + raise ValueError(msg) def date(year: int, month: int, day: int) -> datetime: diff --git a/src/common/endoflife.py b/src/common/endoflife.py index 8e9e9567..c2181368 100644 --- a/src/common/endoflife.py +++ b/src/common/endoflife.py @@ -114,7 +114,8 @@ class Product: def replace_version(self, version: str, date: datetime) -> None: if version not in self.versions: - raise ValueError(f"version {version} cannot be replaced as it does not exist for {self.name}") + msg = f"version {version} cannot be replaced as it does not exist for {self.name}" + raise ValueError(msg) logging.info(f"replacing version {version} ({self.versions[version]} -> {date}) in {self.name}") self.versions[version] = date diff --git a/src/common/git.py b/src/common/git.py index a9f61428..4d85f8c7 100644 --- a/src/common/git.py +++ b/src/common/git.py @@ -20,7 +20,8 @@ class Git: child = run(f"git {cmd}", capture_output=True, timeout=300, check=True, shell=True, cwd=self.repo_dir) return child.stdout.decode("utf-8").strip().split("\n") except ChildProcessError as ex: - raise RuntimeError(f"Failed to run '{cmd}': {ex}") from ex + msg = f"Failed to run '{cmd}': {ex}" + raise RuntimeError(msg) from ex def setup(self, bare: bool = False) -> None: """Creates the repository path and runs: