Skip to content

Enforce EM102 by fixing exception formatting and removing ignore#257

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

Enforce EM102 by fixing exception formatting and removing ignore#257
Copilot wants to merge 2 commits into
mainfrom
copilot/em102-fix-linter-error-another-one

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 1, 2026

This PR addresses EM102 by eliminating an exception f-string in production code and removing EM102 from Ruff’s global ignore list so the rule is enforced going forward.

  • Scope of change

    • TaskflowHeader version validation (src/seclab_taskflow_agent/models.py)
      • Replaced inline f-string construction in raise ValueError(...) with a pre-assigned message variable to comply with EM102.
    • Ruff configuration (pyproject.toml)
      • Removed EM102 from [tool.ruff.lint].ignore baseline suppressions.
  • Code example

    if v != SUPPORTED_VERSION:
        msg = f"Unsupported version: {v}. Only version {SUPPORTED_VERSION} is supported."
        raise ValueError(msg)

Copilot AI review requested due to automatic review settings June 1, 2026 13:36
Copilot AI review requested due to automatic review settings June 1, 2026 13:36
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 EM102 and remove from suppression list Enforce EM102 by fixing exception formatting and removing ignore Jun 1, 2026
Copilot AI requested a review from kevinbackhouse June 1, 2026 13:57
@kevinbackhouse kevinbackhouse marked this pull request as ready for review June 1, 2026 14:57
Copilot AI review requested due to automatic review settings June 1, 2026 14:57
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 aims to start enforcing Ruff rule EM102 (no f-strings directly inside exception constructors) by updating one offending ValueError(...) site and removing EM102 from Ruff’s global ignore list so future code must comply.

Changes:

  • Refactors TaskflowHeader._validate_version() to avoid raising an exception with an inline f-string.
  • Updates pyproject.toml to remove EM102 from [tool.ruff.lint].ignore.
Show a summary per file
File Description
src/seclab_taskflow_agent/models.py Refactors exception message construction to comply with EM102.
pyproject.toml Removes EM102 from the global Ruff ignore list to enforce the rule.

Copilot's findings

Tip

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

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

Comment thread pyproject.toml
Comment on lines 183 to 187
# Style choices — deliberate project conventions
"EM101", # Exception string literals
"EM102", # Exception f-strings
"G004", # Logging f-strings
"T201", # print() used for user output
"TRY003", # Raise with inline message strings
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.

EM102

4 participants