diff --git a/pyproject.toml b/pyproject.toml index b1e81e91..fa39d73f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -172,6 +172,24 @@ dirty = true cache-dir = ".cache/ruff" # allow for a wide-birth relative to what black will correct to line-length = 150 + +extend-exclude = [ + "**/tests/**", + "src/vunnel/providers/mariner/model/**" # these are generated +] + +[tool.ruff.lint] +ignore = [ + "ARG001", # unused args are ok, as they communicate intent in interfaces, even if not used in impls. + "ARG002", # unused args are ok, as they communicate intent in interfaces, even if not used in impls. + "G004", # it's ok to use formatted strings for logging + "PGH004", # no blanked "noqa" usage, can be improved over time, but not now + "PLR2004", # a little too agressive, not allowing any magic numbers + "PLW2901", # "Outer for loop variable X overwritten by inner assignment target", not useful in most cases + "RUF100", # no blanket "noqa" usage, can be improved over time, but not now + "UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)` -- not compatible with python 3.9 (even with __future__ import) +] + select = [ "A", # flake8-builtins # "ANN", # flake8-annotations # this is great, but let mypy handle this so it can honor type:ignore comments without noqa comments too @@ -212,22 +230,6 @@ select = [ "YTT", # flake8-2020 ] -ignore = [ - "ARG001", # unused args are ok, as they communicate intent in interfaces, even if not used in impls. - "ARG002", # unused args are ok, as they communicate intent in interfaces, even if not used in impls. - "G004", # it's ok to use formatted strings for logging - "PGH004", # no blanked "noqa" usage, can be improved over time, but not now - "PLR2004", # a little too agressive, not allowing any magic numbers - "PLW2901", # "Outer for loop variable X overwritten by inner assignment target", not useful in most cases - "RUF100", # no blanket "noqa" usage, can be improved over time, but not now - "UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)` -- not compatible with python 3.9 (even with __future__ import) -] - -extend-exclude = [ - "**/tests/**", - "src/vunnel/providers/mariner/model/**" # these are generated -] - [tool.ruff.lint.flake8-tidy-imports.banned-api] "json.dump".msg = "Use orjson.dumps instead" "json.dumps".msg = "Use orjson.dumps instead" diff --git a/src/vunnel/providers/debian/parser.py b/src/vunnel/providers/debian/parser.py index 02d603dd..8c5b6227 100644 --- a/src/vunnel/providers/debian/parser.py +++ b/src/vunnel/providers/debian/parser.py @@ -157,7 +157,7 @@ def _parse_dsa_record(self, dsa_lines): # noqa: C901 version = version.strip() if version else None if not version: self.logger.debug( - f"release version not included dsa: {dsa.get('id', None)}, distro: {distro}, pkg: {pkg}", + f"release version not included dsa: {dsa.get('id')}, distro: {distro}, pkg: {pkg}", ) dsa["fixed_in"].append({"distro": distro, "pkg": pkg, "ver": version}) continue @@ -168,7 +168,7 @@ def _parse_dsa_record(self, dsa_lines): # noqa: C901 version = version.strip() if version else None if not version: self.logger.debug( - f"release version not included dsa: {dsa.get('id', None)}, distro: {distro}, pkg: {pkg}", + f"release version not included dsa: {dsa.get('id')}, distro: {distro}, pkg: {pkg}", ) dsa["fixed_in"].append({"distro": distro, "pkg": pkg, "ver": version}) continue diff --git a/src/vunnel/providers/rhel/parser.py b/src/vunnel/providers/rhel/parser.py index 51dd5c07..4a852db8 100644 --- a/src/vunnel/providers/rhel/parser.py +++ b/src/vunnel/providers/rhel/parser.py @@ -610,7 +610,7 @@ def _parse_affected_release(self, cve_id: str, content) -> list[FixedIn]: # noq return fixed_ins def _parse_package_name_and_module(self, item: dict) -> tuple[str | None, str | None]: - package_name = item.get("package_name", None) + package_name = item.get("package_name") module = None if package_name and "/" in package_name: diff --git a/src/vunnel/providers/ubuntu/__init__.py b/src/vunnel/providers/ubuntu/__init__.py index 373304d1..9dcb3f60 100644 --- a/src/vunnel/providers/ubuntu/__init__.py +++ b/src/vunnel/providers/ubuntu/__init__.py @@ -21,7 +21,7 @@ class Config: ), ) request_timeout: int = 125 - additional_versions: dict[str, str] = field(default_factory=lambda: {}) + additional_versions: dict[str, str] = field(default_factory=dict) enable_rev_history: bool = True parallelism: int = default_max_workers git_url: str = default_git_url