diff --git a/dokimi/changelog.d/20261113_120000_napetrov_ruf100-unused-noqa.md b/dokimi/changelog.d/20261113_120000_napetrov_ruf100-unused-noqa.md new file mode 100644 index 000000000..b5142ccc2 --- /dev/null +++ b/dokimi/changelog.d/20261113_120000_napetrov_ruf100-unused-noqa.md @@ -0,0 +1,5 @@ +### Changed + +- **ruff now flags a stale `# noqa`** — RUF100 is selected, and the four `# noqa: F401` comments that silenced + nothing are removed. Codes of rules dokimi does not select (BLE001, E402, E731 and a few more) are listed in + `lint.external`, so their `noqa` comments stay. No runtime change. diff --git a/dokimi/dokimi/eval/arm_runner.py b/dokimi/dokimi/eval/arm_runner.py index 9440d3384..cf642893d 100644 --- a/dokimi/dokimi/eval/arm_runner.py +++ b/dokimi/dokimi/eval/arm_runner.py @@ -19,7 +19,7 @@ from typing import Any, Dict, List, Optional, Sequence from dokimi.caching import is_empty_reply -from dokimi.utils import question_id # noqa: F401 (re-exported: callers import it from here) +from dokimi.utils import question_id # re-exported: callers import it from here from dokimi.artifacts import save_artifact from dokimi.llm import llm_call_with_usage from dokimi.defaults import DEFAULT_ANSWER_MODEL, DEFAULT_ANSWER_PROVIDER diff --git a/dokimi/dokimi/harnesses/container_agent.py b/dokimi/dokimi/harnesses/container_agent.py index 2cbcfb9bd..d047568f8 100644 --- a/dokimi/dokimi/harnesses/container_agent.py +++ b/dokimi/dokimi/harnesses/container_agent.py @@ -50,7 +50,7 @@ from dokimi import docker_cmd, process from dokimi.docker_cmd import TASK_CONTAINER_HARDENING, Docker # noqa: F401 (Docker is re-exported) -from dokimi.docker_cmd import STEP_TIMEOUT_S as DOCKER_STEP_TIMEOUT # noqa: F401 +from dokimi.docker_cmd import STEP_TIMEOUT_S as DOCKER_STEP_TIMEOUT from . import egress_proxy from .agent_sandbox import ( diff --git a/dokimi/dokimi/harnesses/docker_solver.py b/dokimi/dokimi/harnesses/docker_solver.py index c91a3d571..e32d3992e 100644 --- a/dokimi/dokimi/harnesses/docker_solver.py +++ b/dokimi/dokimi/harnesses/docker_solver.py @@ -79,7 +79,7 @@ resolve_recorded, skill_needs, start_args, redact as _redact) from .skill_treatment import Treatment, build_plugin, check_skill, skill_listing, treatment_notice from .solver_stream import record_solver, run_solver -from .task_env import _exec_env, unresolved_env # noqa: F401 (re-exported) +from .task_env import _exec_env, unresolved_env # re-exported from .tbench_v1 import reward as _pytest_reward from .tasks import ( # noqa: F401 (timeouts re-exported) _DEFAULT_BUILD_TIMEOUT, diff --git a/dokimi/dokimi/mcp/mcp_protocol.py b/dokimi/dokimi/mcp/mcp_protocol.py index 0353a1aee..977fc62b7 100644 --- a/dokimi/dokimi/mcp/mcp_protocol.py +++ b/dokimi/dokimi/mcp/mcp_protocol.py @@ -33,7 +33,7 @@ def _require_mcp(): """Import the optional ``mcp`` SDK or raise a helpful error.""" try: - import mcp # noqa: F401 + import mcp return mcp except ImportError as exc: # pragma: no cover - exercised via tests with monkeypatch raise MCPConnectionError( diff --git a/dokimi/pyproject.toml b/dokimi/pyproject.toml index 64868be4e..1faec2c92 100644 --- a/dokimi/pyproject.toml +++ b/dokimi/pyproject.toml @@ -188,8 +188,6 @@ extend-exclude = ["benchmarks", "data", "tests/fixtures/task_formats"] # files above for 3.11: # UP (pyupgrade) 1399, of which PEP 585/604 annotations 1185, imports 162 # I (isort) 156 -# RUF100 (unused noqa) 22: most name rules not selected (BLE001, E402), so -# select those or list them in lint.external first # Hand fixes deferred because an open PR rewrites the same lines (#29, one # process runner for the spawn sites): # PLW1509 (preexec_fn with threads) 1, PLW1510 (subprocess.run without @@ -226,8 +224,10 @@ select = [ "RUF006", "RUF008", "RUF009", "RUF013", "RUF016", "RUF017", "RUF018", "RUF020", "RUF024", "RUF026", "RUF028", "RUF030", "RUF032", "RUF033", "RUF034", "RUF040", "RUF048", "RUF049", "RUF053", "RUF060", "RUF061", "RUF063", "RUF064", - "RUF068", "RUF071", "RUF101", "RUF102", "RUF103", "RUF104", "RUF200", + "RUF068", "RUF071", "RUF100", "RUF101", "RUF102", "RUF103", "RUF104", "RUF200", ] +# noqa codes of rules not selected here; RUF100 leaves them alone. +external = ["ARG001", "BLE001", "E402", "E731", "N802", "N818", "S310"] ignore = [ "A002", # argument named like a builtin: keyword APIs mirror subprocess's input= "G004", # f-string in a logging call: style, 108 sites