Skip to content

Enhancement: audit all enrichment rules against authoritative sources #390

@Alberto-Codes

Description

@Alberto-Codes

Description

Issue #387 revealed that _is_stub_function() diverged from ruff's is_stub() without documenting the divergence. Party-mode research session (2026-03-23) uncovered several additional gaps in stub/interface detection.

This issue tracks a broader audit: every enrichment rule should be grounded against its authoritative source (PEP, ruff rule, Google style guide) with a documented truth table of expected behavior.

Motivation

docvet positions itself as going beyond ruff's D rules. But undocumented divergence from ruff is perceived as a bug by users who use both tools. We need to explicitly state where we align, where we diverge, and why.

Scope

For each enrichment rule, document:

  1. Authority: Which PEP, ruff rule, or style guide defines the expected behavior?
  2. Skip conditions: What decorators, body patterns, or class contexts should suppress the rule? Compare against ruff's implementation.
  3. Truth table: A matrix of inputs (body patterns, decorators, class types) vs expected output (finding / no finding).
  4. Divergences: Any intentional differences from ruff, with rationale.

Specific areas to audit (from party-mode research)

  • All forward rules: skip conditions for abstract/stub/overload
  • All reverse rules: skip conditions via _should_skip_reverse_check
  • @typing.override (PEP 698): Google style says overriding methods with @override don't need docstrings — do we handle this?
  • raise NotImplemented (without Error): ruff accepts both; we only accept NotImplementedError
  • typing.TYPE_CHECKING block functions: effectively stubs, not currently detected
  • Protocol class membership: no tool detects this, but document the decision

Deliverable

A reference document (e.g., docs/rule-authority-matrix.md) mapping every rule to its grounding sources, plus any code fixes for identified gaps.

Related issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requeststub-auditStub/interface detection gaps — aligning with PEPs and ruff

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions