Skip to content

Enable Ruff TRY003 by removing inline exception messages#254

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/try003-fix-linter-error-another-one
Draft

Enable Ruff TRY003 by removing inline exception messages#254
Copilot wants to merge 2 commits into
mainfrom
copilot/try003-fix-linter-error-another-one

Conversation

Copilot AI commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

This removes the global TRY003 suppression from Ruff and brings the existing exception-raising code into compliance. The change preserves current exception types and message text while eliminating inline message construction at raise sites.

  • What changed

    • Removed TRY003 from the Ruff ignore list in pyproject.toml.
    • Added a small shared helper for constructing exceptions from message strings.
    • Replaced existing raise SomeError("...") / raise SomeError(f"...") patterns across the Python codebase with helper-based construction.
  • Why this shape

    • Keeps the change mechanical and low-risk.
    • Avoids introducing a large number of one-off exception subclasses solely to satisfy the lint rule.
    • Preserves current runtime behavior and error text.
  • New shared pattern

    from seclab_taskflow_agent.error_utils import error_with_message
    
    raise error_with_message(
        BackendTimeoutError,
        f"Backend stream idle for {STREAM_IDLE_TIMEOUT}s",
    )
  • Scope of refactor

    • Runner and stream handling
    • YAML/resource loading
    • MCP transport/lifecycle utilities
    • CodeQL MCP server/client helpers
    • CLI, session, template, and SDK backend validation paths
  • Supporting changes

    • Added a focused unit test for the new exception-construction helper.

Copilot AI review requested due to automatic review settings June 1, 2026 13:35
Copilot AI review requested due to automatic review settings June 1, 2026 13:35
Copilot AI linked an issue Jun 1, 2026 that may be closed by this pull request
Copilot AI requested review from Copilot and removed request for Copilot June 1, 2026 13:55
Copilot AI changed the title [WIP] Fix linter error TRY003 and remove it from suppression list Enable Ruff TRY003 by removing inline exception messages Jun 1, 2026
Copilot AI requested a review from kevinbackhouse June 1, 2026 13:58
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.

TRY003

2 participants