Skip to content

Fix FBT002: make boolean default positional args keyword-only#205

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/fbt002-fix-linter-error
Closed

Fix FBT002: make boolean default positional args keyword-only#205
Copilot wants to merge 3 commits intomainfrom
copilot/fbt002-fix-linter-error

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

Ruff rule FBT002 ("Boolean default positional argument in function definition") was suppressed globally. This removes the suppression by fixing all 20 violations across the codebase.

Changes

  • Keyword-only boolean params — added * separator before boolean-defaulted params in:

    • agent.pyexclude_from_context
    • cli.pylist_models, debug (and trailing params)
    • mcp_lifecycle.pyheadless
    • render_utils.pylog, async_task
    • template_utils.pyrequired
    • runner.py (local run_prompts) → async_task
    • mcp_servers/codeql/client.pylog_stderr (CodeQL.__init__), keep_alive/log_stderr (QueryServer.__init__, run_query), strip_leading_slash (_get_source_prefix), as_uri/strip_prefix (list_src_files, search_in_src_archive)
    • mcp_servers/codeql/jsonrpyc/__init__.pydaemon, start (Watchdog.__init__)
  • Call-site fixrunner.py was passing headless positionally to build_mcp_servers; updated to headless=headless.

  • pyproject.toml — removed FBT002 from the ignore list.

Example fix pattern

# Before
def build_mcp_servers(
    available_tools: AvailableTools,
    toolboxes: list[str],
    blocked_tools: list[str] | None = None,
    headless: bool = False,
) -> list[MCPServerEntry]: ...

# After
def build_mcp_servers(
    available_tools: AvailableTools,
    toolboxes: list[str],
    blocked_tools: list[str] | None = None,
    *,
    headless: bool = False,
) -> list[MCPServerEntry]: ...

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
Copilot AI changed the title [WIP] Fix linter error FBT002 and remove from suppression list Fix FBT002: make boolean default positional args keyword-only Apr 2, 2026
@kevinbackhouse kevinbackhouse marked this pull request as ready for review April 2, 2026 15:33
Copilot AI review requested due to automatic review settings April 2, 2026 15:33
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 removes the global suppression for Ruff rule FBT002 by updating function signatures across the codebase so boolean parameters with defaults are keyword-only, preventing accidental positional boolean arguments.

Changes:

  • Made boolean-defaulted parameters keyword-only (added *) across multiple functions/classes (agent, CLI, MCP lifecycle, rendering, templating, and CodeQL utilities).
  • Updated the one in-repo call site that passed a newly keyword-only boolean positionally (build_mcp_servers(..., headless=headless)).
  • Removed FBT002 from Ruff’s global ignore list in pyproject.toml.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/seclab_taskflow_agent/template_utils.py Makes required keyword-only in env_function to satisfy FBT002.
src/seclab_taskflow_agent/runner.py Fixes build_mcp_servers call site and makes run_prompts.async_task keyword-only.
src/seclab_taskflow_agent/render_utils.py Makes log/async_task keyword-only for render_model_output.
src/seclab_taskflow_agent/mcp_servers/codeql/jsonrpyc/init.py Makes daemon/start keyword-only in Watchdog.__init__.
src/seclab_taskflow_agent/mcp_servers/codeql/client.py Makes several boolean-default params keyword-only across CodeQL helpers and constructors.
src/seclab_taskflow_agent/mcp_lifecycle.py Makes headless keyword-only in build_mcp_servers.
src/seclab_taskflow_agent/cli.py Makes CLI boolean flags keyword-only in main (Typer options).
src/seclab_taskflow_agent/agent.py Makes exclude_from_context keyword-only in TaskAgent.__init__.
pyproject.toml Removes FBT002 from Ruff ignore list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

FBT002

3 participants