Skip to content

Replace TRY003 suppressions with custom exceptions / message constants #537

Description

@tschm

Context

From the Rhiza quality assessment (all 7 gates pass; overall ~9.2/10). make suppression-audit reports Grade C (51 suppressions, density 1.07/100 lines). The largest avoidable group is noqa[TRY003] — 16 occurrences (31%): long exception messages written inline at the raise site.

The subprocess-related suppressions (noqa[S603] 45%, nosec[B404]/[B603]) are inherent to wrapping the git CLI and are out of scope here.

Subcategory / score

Linting/style 9 → 10; also lifts Dependency/security-hygiene and the suppression grade C → B.

Where

The 16 # noqa: TRY003 sites, including:

  • src/rhiza/models/_git_utils.py:72
  • src/rhiza/models/bundle.py:46
  • plus sites in src/rhiza/commands/init.py and src/rhiza/commands/summarise.py

(full list: make suppression-audit)

Proposed fix

Extract long messages into custom exception classes or module-level constants so the raise lines no longer trip TRY003, removing the noqa.

Acceptance criterion

Done when make suppression-audit shows no TRY003 entries and the grade improves, and make fmt / make test stay green.

Scope: locally-owned (src/). Not Rhiza-managed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions