Enable flake8-errmsg linting rules (#267)
See https://docs.astral.sh/ruff/rules/#flake8-errmsg-em.
This commit is contained in:
@@ -9,6 +9,7 @@ select = [
|
|||||||
"COM", # flake8-commas
|
"COM", # flake8-commas
|
||||||
"DTZ", # flake8-commas
|
"DTZ", # flake8-commas
|
||||||
"E", # pycodestyle errors
|
"E", # pycodestyle errors
|
||||||
|
"EM", # pycodestyle errors
|
||||||
"F", # pyflakes errors
|
"F", # pyflakes errors
|
||||||
"I", # isort
|
"I", # isort
|
||||||
"ISC", # flake8-implicit-str-concat
|
"ISC", # flake8-implicit-str-concat
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ def parse_datetime(text: str, formats: list[str] = frozenset([
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
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:
|
def date(year: int, month: int, day: int) -> datetime:
|
||||||
|
|||||||
@@ -114,7 +114,8 @@ class Product:
|
|||||||
|
|
||||||
def replace_version(self, version: str, date: datetime) -> None:
|
def replace_version(self, version: str, date: datetime) -> None:
|
||||||
if version not in self.versions:
|
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}")
|
logging.info(f"replacing version {version} ({self.versions[version]} -> {date}) in {self.name}")
|
||||||
self.versions[version] = date
|
self.versions[version] = date
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ class Git:
|
|||||||
child = run(f"git {cmd}", capture_output=True, timeout=300, check=True, shell=True, cwd=self.repo_dir)
|
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")
|
return child.stdout.decode("utf-8").strip().split("\n")
|
||||||
except ChildProcessError as ex:
|
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:
|
def setup(self, bare: bool = False) -> None:
|
||||||
"""Creates the repository path and runs:
|
"""Creates the repository path and runs:
|
||||||
|
|||||||
Reference in New Issue
Block a user