Skip to content

Commit

Permalink
chore: update formatting with latest ruff
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Phillips <[email protected]>
  • Loading branch information
spiffcs committed Feb 6, 2024
1 parent e4f51b7 commit 992da67
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
34 changes: 18 additions & 16 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/vunnel/providers/debian/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/vunnel/providers/rhel/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/vunnel/providers/ubuntu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 992da67

Please sign in to comment.