[RUFF] Enable FBT002 rule (boolean default in positional args)#1048
[RUFF] Enable FBT002 rule (boolean default in positional args)#1048agentydragon wants to merge 1 commit intodevelfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enables Ruff’s FBT002 rule (boolean defaults in positional args) and updates the codebase to comply by making boolean-default parameters keyword-only or explicitly suppressing the rule for framework-required callback signatures.
Changes:
- Enabled
FBT002inruff.tomland added a targeted per-file ignore. - Updated many function/method signatures to make boolean-default parameters keyword-only (
*) and adjusted call sites accordingly. - Added
# noqa: FBT002suppressions for framework callback entrypoints (Typer/Invoke/FastMCP) where signatures can’t be changed safely.
Reviewed changes
Copilot reviewed 52 out of 52 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| x/gitea/pr_gate/policy_common.py | Makes admin keyword-only in user_headers. |
| x/cotrl/llm_rl_experiment.py | Makes first_step keyword-only and updates call site. |
| x/claude_linter_v2/session/manager.py | Makes all_dirs keyword-only in list_sessions. |
| x/claude_linter_v2/linters/python_ruff.py | Makes critical_only keyword-only in check_code. |
| x/claude_linter_v2/linters/python_ast.py | Makes analyzer feature flags keyword-only in __init__. |
| x/claude_linter_v2/checker.py | Makes fix/categories/verbose keyword-only in FileChecker.__init__. |
| x/claude_linter_v2/check_python.py | Makes critical_only keyword-only in check_python_file. |
| x/claude_linter/config.py | Makes fix keyword-only in get_merged_config. |
| x/agent_server/server/conftest.py | Makes is_error keyword-only in test factories; updates internal calls. |
| wt/testing/config_factory.py | Makes enabled keyword-only in with_github. |
| wt/server/worktree_service.py | Makes force keyword-only in remove_worktree. |
| wt/server/git_manager.py | Makes force keyword-only in worktree_remove. |
| wt/client/view_formatter.py | Makes is_draft/merged_at keyword-only and updates call sites. |
| wt/client/handlers.py | Makes force keyword-only in handle_remove_worktree. |
| wt/cli.py | Adjusts calls to match new keyword-only params (verbose, force). |
| tana/render/html_utils.py | Makes unescape keyword-only in process_inline_refs. |
| tana/query/search/evaluator.py | Makes evaluator flags keyword-only; updates filter calls to use keywords. |
| tana/query/filters.py | Makes skip_trash/skip_deleted keyword-only; updates call-throughs. |
| sysrw/run_eval.py | Makes _final keyword-only and updates callers. |
| sysrw/leaderboard.py | Makes asc keyword-only in generate. |
| sysrw/extract_dataset_crush.py | Makes require_bad keyword-only in process_wire. |
| skills/proxmox_vm/vm_interact.py | Adds # noqa: FBT002 for Typer boolean option defaults. |
| skills/hetzner_vnc_screenshot/vnc_screenshot.py | Adds # noqa: FBT002 for Typer boolean option default. |
| ruff.toml | Enables FBT002 (but currently has duplicate entries / invalid TOML key). |
| props/core/gepa/gepa_adapter.py | Makes verbose and capture_traces keyword-only. |
| props/cli/cmd_gepa.py | Adds # noqa: FBT002 for Typer boolean options. |
| openai_utils/pydantic_strict_mode.py | Makes boolean flags keyword-only in check_recursive. |
| mcp_infra/exec/test_seatbelt.py | Makes trace keyword-only in helper factory. |
| llm/mcp/habitify/server.py | Adds # noqa: FBT002 for tool callback signature. |
| llm/mcp/habitify/config.py | Makes exit_on_missing keyword-only. |
| llm/mcp/habitify/cli.py | Makes include_archived/api_key keyword-only in async helper. |
| llm/html/llm_html/server.py | Makes is_index keyword-only. |
| laser/material_test/material_test.py | Makes rotate90ccw keyword-only. |
| inventree_utils/tasks.py | Adds # noqa: FBT002 for Invoke task signature. |
| inop/runners/base.py | Makes is_docker keyword-only. |
| inop/io/logging_utils.py | Makes verbose keyword-only in setup_logging. |
| gmail_archiver/planners/aliexpress.py | Makes should_compute_deadline keyword-only. |
| gmail_archiver/plan_display.py | Makes show_subject and group_by_category keyword-only; updates call sites. |
| gmail_archiver/main.py | Adds # noqa: FBT002 for Typer boolean options/defaults. |
| gmail_archiver/inbox.py | Makes show_progress keyword-only. |
| gmail_archiver/gmail_client.py | Makes retry_failures/archive keyword-only. |
| gmail_archiver/event_classifier.py | Makes use_cache/max_concurrent keyword-only. |
| gmail_archiver/cli/labels.py | Adds # noqa: FBT002 for Typer boolean option default. |
| difftree/tree.py | Makes reverse keyword-only and updates recursive call. |
| difftree/test_tree.py | Makes reverse keyword-only in helper. |
| difftree/conftest.py | Makes force_terminal keyword-only in test helper. |
| devinfra/claude/testing/shell_helpers.py | Makes check/env keyword-only. |
| devinfra/claude/supervisor/client.py | Makes wait keyword-only for start/stop methods. |
| devinfra/claude/streaming.py | Makes check/env keyword-only in run_streaming. |
| agent_core/testing/responses.py | Makes check_consumed keyword-only. |
| agent_core/test_tool_execution.py | Makes parallel keyword-only in test helper. |
| agent_core/progress.py | Makes force keyword-only in _render. |
| "PERF", # perflint | ||
| "FAST", # FastAPI best practices | ||
| "TRY004", # prefer TypeError for type checks | ||
| "EXE", # shebang/executable consistency | ||
| "FBT002", # boolean default in positional args | ||
| "FBT002", # boolean default in positional args | ||
| "RUF" # ruff-specific |
There was a problem hiding this comment.
select contains FBT002 twice, and EXE appears to have been removed from the selected rule sets in the same hunk. If the intent is only to enable FBT002, drop the duplicate and confirm whether EXE should remain enabled (otherwise this PR changes shebang/executable linting behavior beyond the description).
| "ansible/library/autostart_entry.py" = ["EXE001"] | ||
| "devinfra/rbe_image/dockerd_wrapper.py" = ["EXE001"] | ||
| "airlock/auth_proxy/proxy.py" = ["FBT002"] | ||
| "airlock/auth_proxy/proxy.py" = ["FBT002"] |
There was a problem hiding this comment.
The [lint.per-file-ignores] table defines "airlock/auth_proxy/proxy.py" twice. Duplicate keys make the TOML invalid for many parsers and can break tooling that reads ruff.toml. Keep only a single entry for that file (and only one FBT002 ignore list).
| "airlock/auth_proxy/proxy.py" = ["FBT002"] |
fa456f1 to
200c628
Compare
Adds `FBT002` to ruff.toml. Fixes 77 violations: - 66 made keyword-only (added `*` separator, updated all call sites) - 11 suppressed with `# noqa: FBT002` (framework callbacks: Typer CLI options, invoke @task, FastMCP @server.tool) - 1 per-file-ignore (airlock/auth_proxy/proxy.py — httpx override) https://claude.ai/code/session_013WcexLQ8JPJG1j79uvMfCF
200c628 to
7a2ef0c
Compare
Summary
FBT002inruff.toml*separator added, all call sites updated)# noqa: FBT002(framework callbacks: Typer CLI options, invoke@task, FastMCP@server.tool)airlock/auth_proxy/proxy.py— httpx method override)https://claude.ai/code/session_013WcexLQ8JPJG1j79uvMfCF