Skip to content

enhancement: validate suppression policy names against known policies at config load time #94

@egouilliard-leyton

Description

@egouilliard-leyton

Context

Discovered during implementation of arch-check suppression (issue #23 / PR from branch archon/task-feat-issue-23-arch-check-suppression).

Description

_parse_suppressions() accepts any string for policy with no validation against known policy names. A typo like policy = "import_cycle" (missing trailing s) will silently load, never match any violation, and surface only as a stale suppression warning at runtime — requiring a full arch-check run to catch.

This is intentional for custom policies (which have arbitrary names), but built-in policy names are a closed set: import_cycles, cross_package, layer_bypass, coupling_ceiling, orphan_detection.

Suggested approach

In _parse_suppressions(), after loading policy, check if it matches a built-in name or any [[custom]] policy name defined in the same config. If it matches neither, emit an ArchConfigError with a "did you mean X?" suggestion (using difflib.get_close_matches). This catches typos at config-load time rather than waiting for a stale warning at run time.

Custom policy names are available from config.custom at the call site; threading them in is straightforward.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions