From 985c0f94e633dcab9f51e0da459ad049d8f8c73b Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Wed, 28 Aug 2024 01:51:14 +0100 Subject: [PATCH] ruff: attempt to enable ARG checks, suppress in some places --- my/core/pytest.py | 2 +- my/core/utils/itertools.py | 6 +++--- my/pdfs.py | 2 +- ruff.toml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/my/core/pytest.py b/my/core/pytest.py index c73c71a..e514957 100644 --- a/my/core/pytest.py +++ b/my/core/pytest.py @@ -15,7 +15,7 @@ if typing.TYPE_CHECKING or under_pytest: parametrize = pytest.mark.parametrize else: - def parametrize(*args, **kwargs): + def parametrize(*_args, **_kwargs): def wrapper(f): return f diff --git a/my/core/utils/itertools.py b/my/core/utils/itertools.py index b945ad8..ae9402d 100644 --- a/my/core/utils/itertools.py +++ b/my/core/utils/itertools.py @@ -63,7 +63,7 @@ def test_ensure_unique() -> None: list(it) # hacky way to force distinct objects? - list(ensure_unique(dups, key=lambda i: object())) + list(ensure_unique(dups, key=lambda _: object())) def make_dict( @@ -115,7 +115,7 @@ def _listify(func: Callable[LFP, Iterable[LV]], *args: LFP.args, **kwargs: LFP.k # so seems easiest to just use specialize instantiations of decorator instead if TYPE_CHECKING: - def listify(func: Callable[LFP, Iterable[LV]]) -> Callable[LFP, List[LV]]: ... + def listify(func: Callable[LFP, Iterable[LV]]) -> Callable[LFP, List[LV]]: ... # noqa: ARG001 else: listify = _listify @@ -162,7 +162,7 @@ def _warn_if_empty(func, *args, **kwargs): if TYPE_CHECKING: FF = TypeVar('FF', bound=Callable[..., Iterable]) - def warn_if_empty(f: FF) -> FF: ... + def warn_if_empty(func: FF) -> FF: ... # noqa: ARG001 else: warn_if_empty = _warn_if_empty diff --git a/my/pdfs.py b/my/pdfs.py index db49c0e..de9324d 100644 --- a/my/pdfs.py +++ b/my/pdfs.py @@ -25,7 +25,7 @@ class config(Protocol): def paths(self) -> Paths: return () # allowed to be empty for 'filelist' logic - def is_ignored(self, p: Path) -> bool: + def is_ignored(self, p: Path) -> bool: # noqa: ARG002 """ You can override this in user config if you want to ignore some files that are tooheavy """ diff --git a/ruff.toml b/ruff.toml index 3d97fc9..e7c6f07 100644 --- a/ruff.toml +++ b/ruff.toml @@ -10,8 +10,8 @@ lint.extend-select = [ "PLR", # 'refactor' rules "B", # 'bugbear' set -- various possible bugs - - + # "FA", # TODO enable later after we make sure cachew works? + # "ARG", # TODO useful, but results in some false positives in pytest fixtures... maybe later # "S", # bandit (security checks) -- tends to be not very useful, lots of nitpicks # "DTZ", # datetimes checks -- complaining about missing tz and mostly false positives ]