Fix FBT001: convert boolean positional args to keyword-only#203
Fix FBT001: convert boolean positional args to keyword-only#203
Conversation
… suppression list Agent-Logs-Url: https://github.com/GitHubSecurityLab/seclab-taskflow-agent/sessions/8c3fabc6-bff8-433a-9338-a8021e49fc4d Co-authored-by: kevinbackhouse <4358136+kevinbackhouse@users.noreply.github.com>
|
@copilot fix the errors |
Agent-Logs-Url: https://github.com/GitHubSecurityLab/seclab-taskflow-agent/sessions/3c237b9a-7f89-4863-9650-2c7b11047490 Co-authored-by: kevinbackhouse <4358136+kevinbackhouse@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR eliminates Ruff FBT001 (boolean-typed positional args) violations by making boolean parameters keyword-only across the taskflow agent codebase, updating affected call sites, and then removing FBT001 from the Ruff ignore list to enforce the rule going forward.
Changes:
- Added
*keyword-only separators to function/method signatures where boolean parameters were previously positional. - Updated call sites to pass those booleans by keyword (e.g.,
headless=headless,repeat_prompt=repeat_prompt). - Removed
FBT001frompyproject.tomlRuff ignore list.
Show a summary per file
| File | Description |
|---|---|
| src/seclab_taskflow_agent/agent.py | Makes exclude_from_context keyword-only in TaskAgent.__init__. |
| src/seclab_taskflow_agent/mcp_lifecycle.py | Makes headless keyword-only in build_mcp_servers. |
| src/seclab_taskflow_agent/render_utils.py | Makes log/async_task keyword-only in render_model_output. |
| src/seclab_taskflow_agent/runner.py | Updates call sites for new keyword-only parameters; makes inner run_prompts bool kw-only; makes _build_prompts_to_run kwargs-only. |
| src/seclab_taskflow_agent/session.py | Makes success keyword-only in record_task. |
| src/seclab_taskflow_agent/template_utils.py | Makes required keyword-only in env_function. |
| src/seclab_taskflow_agent/mcp_servers/codeql/jsonrpyc/init.py | Makes daemon/start keyword-only in Watchdog.__init__. |
| scripts/migrate_to_jinja2.py | Makes dry_run and recursive keyword-only in the migration script API. |
| pyproject.toml | Stops ignoring FBT001 so future boolean positional args are caught by linting. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 9/9 changed files
- Comments generated: 0
|
not principally opposed to enforcing this style, but not sure it adds much in terms of readability/understanding of the code, can we consider excluding this from our linting? there's also some cases where the PR proposes named arg boundaries for unnamed args (left comments at those) it seems, so that needs a poke it feels like. |
Resolves all
FBT001(Boolean-typed positional argument in function definition) violations and removes the rule from thepyproject.tomlsuppression list.Changes
*keyword-only separator added to boolean parameters across 7 modules:agent.py→TaskAgent.__init__:exclude_from_contextmcp_lifecycle.py→build_mcp_servers:headlessrender_utils.py→render_model_output:log,async_taskrunner.py→_build_prompts_to_run:repeat_prompt; innerrun_prompts:async_tasksession.py→record_task:successtemplate_utils.py→env_function:requiredjsonrpyc/__init__.py→Watchdog.__init__:daemon,startCall sites updated where boolean args were previously passed positionally:
runner.py:build_mcp_servers(..., headless)→build_mcp_servers(..., headless=headless)runner.py:_build_prompts_to_run(prompt, repeat_prompt, ...)→ explicit keyword argspyproject.toml: removed"FBT001"from[tool.ruff.lint] ignoreExample
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
unsupported.example.com/usr/bin/python python -m pytest tests/ -x -q(dns block)If you need me to access, download, or install something from one of these locations, you can either: