Skip to content

chore: audit and tighten linting exceptions #416

@wphillipmoore

Description

@wphillipmoore

Linting Exception Audit

Audit from mq-rest-admin-project/mq-rest-admin-common#118.

Current Exceptions (~80 total)

Config-Level (14)

  • 4 global ruff ignores: E501 (formatter handles), D203/D213 (docstring preference), COM812 (formatter conflict)
  • 6 per-file ignores: tests (D1, S101, S105, S106), examples (INP001, T201)
  • mypy: strict mode, all checks enabled — no exceptions

Source Code Inline (7)

  • S105 — hardcoded string constants (error messages, not secrets)
  • PLR2004 — HTTP 400 status code threshold
  • PLR0913 — session constructor with 7 params
  • pragma: no cover — abstract NotImplementedError stubs in base classes

Test Code Inline (~60)

  • ~38× SLF001 — private member access for unit testing internals
  • ~12× type: ignore — frozen dataclass mutation testing, dynamic kwargs, untyped test data
  • PLR2004 — magic number literals in assertions
  • ARG002 — unused callback fixture params
  • S603/S607 — subprocess in integration test

Actionable Items

Quick Win: Move SLF001 to per-file-ignores (~15 min)

Add SLF001 to the existing per-file-ignores block in pyproject.toml:

"tests/**/*.py" = [
    "D1",      # Tests do not require docstrings
    "S101",    # Pytest assert style is expected
    "S105",    # Hardcoded test passwords
    "S106",    # Hardcoded test password arguments
    "SLF001",  # Tests legitimately access private members for unit testing
]

Then remove all 38 inline # noqa: SLF001 comments from test files. This follows the same pattern already used for S101/S105/S106.

Eliminates: 38 inline suppressions

Not Actionable

All remaining exceptions are justified:

  • S105 on error message constants (not secrets)
  • PLR2004 on HTTP status codes and test assertions
  • PLR0913 on session constructor (inherent complexity)
  • pragma: no cover on abstract method stubs (unreachable by design)
  • type: ignore in tests (frozen dataclass mutation, Mockito-style patterns)
  • ARG002 in test fixtures (callback signatures)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    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