Skip to content

Enable Ruff G004 and migrate logging calls to lazy formatting - #255

Merged
kevinbackhouse merged 3 commits into
mainfrom
copilot/g004-fix-linter-error-again
Jun 1, 2026
Merged

kevinbackhouse merged 3 commits into
mainfrom
copilot/g004-fix-linter-error-again

Conversation

Copilot AI commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

This PR addresses issue G004 by removing the G004 suppression from Ruff configuration and updating existing logging f-strings to Ruff-compliant lazy formatting. The goal is to enforce logging best practices without changing runtime behavior.

  • Lint policy update

    • Removed G004 from tool.ruff.lint.ignore in pyproject.toml, so logging f-strings are now enforced repository-wide.
  • Logging call remediation

    • Replaced logging f-strings with lazy interpolation across affected modules (_stream.py, agent.py, mcp_lifecycle.py, mcp_utils.py, prompt_parser.py, runner.py, session.py, shell_utils.py, and mcp_servers/codeql/client.py).
    • Kept message content and severity levels unchanged; only argument formatting was updated.
  • Representative change

    # before
    logging.warning(f"Task {task_name!r} attempt {attempt + 1} failed: {exc}")
    
    # after
    logging.warning("Task %r attempt %s failed: %s", task_name, attempt + 1, exc)

Copilot AI review requested due to automatic review settings June 1, 2026 13:35
Copilot AI removed the request for review from Copilot 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:49
Copilot AI changed the title [WIP] Fix linter error G004 and update suppression list Enable Ruff G004 and migrate logging calls to lazy formatting Jun 1, 2026
Copilot AI requested a review from kevinbackhouse June 1, 2026 13:51
@kevinbackhouse
kevinbackhouse marked this pull request as ready for review June 1, 2026 14:59
Copilot AI review requested due to automatic review settings June 1, 2026 14:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 enables Ruff rule G004 (logging f-strings) by removing it from the Ruff ignore list and updates logging calls across the codebase to use lazy formatting (logger.info("...", arg)) to keep logging best practices enforced without eager string interpolation.

Changes:

  • Removed G004 from tool.ruff.lint.ignore in pyproject.toml.
  • Migrated multiple logging.*(f"...") call sites to lazy %-style formatting across runtime modules.
Show a summary per file
File Description
src/seclab_taskflow_agent/shell_utils.py Switch logging.info from f-string to lazy formatting for shell execution logging.
src/seclab_taskflow_agent/session.py Switch session checkpoint/corrupt-file logging to lazy formatting.
src/seclab_taskflow_agent/runner.py Switch several error/debug/exception logs to lazy formatting in prompt building and task execution.
src/seclab_taskflow_agent/prompt_parser.py Switch prompt parsing error logs to lazy formatting.
src/seclab_taskflow_agent/mcp_utils.py Switch MCP toolbox initialization/debug logs to lazy formatting.
src/seclab_taskflow_agent/mcp_servers/codeql/client.py Switch CodeQL YAML parsing error log to lazy formatting.
src/seclab_taskflow_agent/mcp_lifecycle.py Switch MCP lifecycle logs (connect/cleanup/stdout/stderr) to lazy formatting.
src/seclab_taskflow_agent/agent.py Switch agent/task hook logs to lazy formatting.
src/seclab_taskflow_agent/_stream.py Switch rate-limit backoff logging to lazy formatting.
pyproject.toml Stop ignoring Ruff G004 to enforce logging best practices repo-wide.

Copilot's findings

Tip

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

  • Files reviewed: 10/10 changed files
  • Comments generated: 1

Comment on lines 708 to 712
for result in task_results:
if not isinstance(result, bool):
logging.error(f"Caught exception in Gather: {result}", exc_info=result)
logging.error("Caught exception in Gather: %s", result, exc_info=result)
result = False
complete = result and complete
@kevinbackhouse
kevinbackhouse merged commit 712c308 into main Jun 1, 2026
9 checks passed
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.

G004

4 participants