Module

contracts.rules_kida_analysis

Kida 0.9 static-analysis contract checks.

Functions

collect_literal_attributes 2 dict[str, tuple[Any, ...…
Collect Kida literal attributes once for contract rules that need them.
def collect_literal_attributes(kida_env: Environment, template_sources: dict[str, str]) -> dict[str, tuple[Any, ...]]
Parameters
Name Type Description
kida_env Environment
template_sources dict[str, str]
Returns
dict[str, tuple[Any, ...]]
literal_route_targets 1 list[tuple[str, str, str…
Extract static hx-* route targets from Kida literal attributes.
def literal_route_targets(attrs: Iterable[Any]) -> list[tuple[str, str, str | None]]
Parameters
Name Type Description
attrs Iterable[Any]
Returns
list[tuple[str, str, str | None]]
literal_static_ids 1 set[str]
Extract static id= values from Kida literal attributes.
def literal_static_ids(attrs: Iterable[Any]) -> set[str]
Parameters
Name Type Description
attrs Iterable[Any]
Returns
set[str]
literal_hx_target_selectors 1 list[str]
Extract static hx-target values from Kida literal attributes.
def literal_hx_target_selectors(attrs: Iterable[Any]) -> list[str]
Parameters
Name Type Description
attrs Iterable[Any]
Returns
list[str]
literal_href_references 1 set[str]
Extract static href= route references from Kida literal attributes.
def literal_href_references(attrs: Iterable[Any]) -> set[str]
Parameters
Name Type Description
attrs Iterable[Any]
Returns
set[str]
literal_htmx_partial_sources 1 list[str]
Extract static route references from literal attributes.
def literal_htmx_partial_sources(attrs: Iterable[Any]) -> list[str]
Parameters
Name Type Description
attrs Iterable[Any]
Returns
list[str]
check_component_calls 2 tuple[list[ContractIssue…
Validate local Kida component calls and literal argument types.
def check_component_calls(kida_env: Environment, template_sources: dict[str, str]) -> tuple[list[ContractIssue], int]
Parameters
Name Type Description
kida_env Environment
template_sources dict[str, str]
Returns
tuple[list[ContractIssue], int]
check_template_context_contracts 3 list[ContractIssue]
Validate opt-in dotted template context contracts with Kida.
def check_template_context_contracts(kida_env: Environment, template_sources: dict[str, str], extras: Mapping[str, Any]) -> list[ContractIssue]
Parameters
Name Type Description
kida_env Environment
template_sources dict[str, str]
extras Mapping[str, Any]
Returns
list[ContractIssue]
check_template_escape_audit 2 list[ContractIssue]
Surface Kida trusted-markup findings without failing startup.
def check_template_escape_audit(kida_env: Environment, template_sources: dict[str, str]) -> list[ContractIssue]
Parameters
Name Type Description
kida_env Environment
template_sources dict[str, str]
Returns
list[ContractIssue]
check_template_privacy 2 list[ContractIssue]
Surface Kida privacy lint findings as warning-level contract diagnostics.
def check_template_privacy(kida_env: Environment, template_sources: dict[str, str]) -> list[ContractIssue]
Parameters
Name Type Description
kida_env Environment
template_sources dict[str, str]
Returns
list[ContractIssue]