Skip to content

Fix FBT001: convert boolean positional args to keyword-only#203

Open
Copilot wants to merge 4 commits intomainfrom
copilot/fix-linter-error-fbt001
Open

Fix FBT001: convert boolean positional args to keyword-only#203
Copilot wants to merge 4 commits intomainfrom
copilot/fix-linter-error-fbt001

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

Resolves all FBT001 (Boolean-typed positional argument in function definition) violations and removes the rule from the pyproject.toml suppression list.

Changes

  • * keyword-only separator added to boolean parameters across 7 modules:

    • agent.pyTaskAgent.__init__: exclude_from_context
    • mcp_lifecycle.pybuild_mcp_servers: headless
    • render_utils.pyrender_model_output: log, async_task
    • runner.py_build_prompts_to_run: repeat_prompt; inner run_prompts: async_task
    • session.pyrecord_task: success
    • template_utils.pyenv_function: required
    • jsonrpyc/__init__.pyWatchdog.__init__: daemon, start
  • Call 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 args
  • pyproject.toml: removed "FBT001" from [tool.ruff.lint] ignore

Example

# Before
async def render_model_output(data: str, log: bool = True, async_task: bool = False, ...) -> None:

# After
async def render_model_output(data: str, *, log: bool = True, async_task: bool = False, ...) -> None:

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
    • Triggering command: /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:

Copilot AI linked an issue Apr 2, 2026 that may be closed by this pull request
… 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 AI changed the title [WIP] Fix linter error FBT001 and remove from suppression list Fix FBT001: convert boolean positional args to keyword-only Apr 2, 2026
@kevinbackhouse
Copy link
Copy Markdown
Collaborator

@copilot fix the errors

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 2, 2026

@copilot fix the errors

Fixed in e0b8d0d — the initial pass only scanned src/, missing two FBT001 violations in scripts/migrate_to_jinja2.py (__init__ and migrate_directory). Both boolean params are now keyword-only.

@kevinbackhouse kevinbackhouse marked this pull request as ready for review April 8, 2026 12:49
Copilot AI review requested due to automatic review settings April 8, 2026 12:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 FBT001 from pyproject.toml Ruff 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

@anticomputer
Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FBT001

4 participants