"""Typing contract: no unallowlisted type: ignore in src/auen."""

from __future__ import annotations

from tests.typing.conftest import ViolationTuple


def _format(violations: list[ViolationTuple]) -> str:
    return "\n".join(
        f"{path}:{line}:{column + 1} [{kind}] {message}"
        for kind, path, line, column, message in violations
    )


def test_no_unallowlisted_type_ignore(
    typing_contract_violations: list[ViolationTuple],
) -> None:
    ignore_violations = [
        item for item in typing_contract_violations if item[0] == "type-ignore"
    ]
    assert not ignore_violations, _format(ignore_violations)
