diff --git a/pyproject.toml b/pyproject.toml index 48e4e9a..2bf6f4e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,15 +62,8 @@ select = [ "PL", "RUF", ] -ignore = [ - "E501", # line too long - "ANN401", # ban Any - "PLR0911", # too many returns - "PLR2004", # magic values -] +# long lines +ignore = [ "E501" ] [tool.ruff.lint.per-file-ignores] -"tests/test_main.py" = [ "S101", "ANN201"] -"tests/test_profiles.py" = [ "S101", "ANN201"] -"tests/test_desktop.py" = [ "S101", "ANN201"] -"tests/test_choose.py" = [ "S101", "ANN201"] +"tests/test_*.py" = [ "S101", "ANN201"] diff --git a/src/qbpm/log.py b/src/qbpm/log.py index 8c64bd5..23d0a02 100644 --- a/src/qbpm/log.py +++ b/src/qbpm/log.py @@ -16,7 +16,7 @@ def or_phrase(items: list) -> str: return "[]" elif size == 1: return strings[0] - elif size == 2: + elif size == 2: # noqa: PLR2004 return " or ".join(strings) else: return ", or ".join([", ".join(strings[0:-1]), strings[-1]]) diff --git a/src/qbpm/main.py b/src/qbpm/main.py index 59d8189..263a0bb 100644 --- a/src/qbpm/main.py +++ b/src/qbpm/main.py @@ -4,7 +4,7 @@ from collections.abc import Callable from dataclasses import dataclass from functools import wraps from pathlib import Path -from typing import Any, NoReturn +from typing import Any, NoReturn, TypeVar import click @@ -32,7 +32,10 @@ class CreatorOptions: overwrite: bool -def creator_options(orig: Callable[..., Any]) -> Callable[..., Any]: +T = TypeVar("T") + + +def creator_options(orig: Callable[..., T]) -> Callable[..., T]: @wraps(orig) def command( qb_config_dir: Path | None, @@ -40,9 +43,9 @@ def creator_options(orig: Callable[..., Any]) -> Callable[..., Any]: foreground: bool, desktop_file: bool, overwrite: bool, - *args: Any, - **kwargs: Any, - ) -> Any: + *args: Any, # noqa: ANN401 + **kwargs: Any, # noqa: ANN401 + ) -> T: return orig( *args, c_opts=CreatorOptions(