Validate unit ownership, consumers and publication against its entry action.
Source code in packages/axm-init/src/axm_init/checks/_shared_ticket.py
| Python |
|---|
| def shared_ticket_findings(
project: Path,
domain: str,
units: list[dict[str, object]],
entry_points: dict[str, dict[str, object]],
) -> list[str]:
"""Validate unit ownership, consumers and publication against its entry action."""
findings: list[str] = []
identities: set[str] = set()
for unit in units:
try:
declaration = _declaration(domain, unit)
except ValueError as exc:
findings.append(f"pyproject.toml: invalid shared unit: {exc}")
continue
actions = _actions(unit)
findings.extend(_metadata_findings(declaration, actions, identities))
if declaration is not None:
findings.extend(_unit_findings(project, declaration, actions, entry_points))
local_types = {
action.get("ticket_type") for unit in units for action in _actions(unit)
}
if identities & local_types:
findings.append(
"pyproject.toml: local ticket conflicts with shared ticket type"
)
return findings
|