Classes
ContractCheck
1
▼
Protocol for custom contract check plugins.
Both plain functions and callable class instances sati…
ContractCheck
1
▼
Protocol for custom contract check plugins.
Both plain functions and callable class instances satisfy this
protocol. Register viaapp.register_contract_check().
Example — function form::
def my_check(snapshot: ContractCheckSnapshot, result: CheckResult) -> None:
for name, source in snapshot.template_sources.items():
if "TODO" in source:
result.issues.append(
ContractIssue(Severity.WARNING, "todo", f"TODO in {name}", template=name)
)
Example — class form::
class ComponentCheck:
def __call__(self, snapshot: ContractCheckSnapshot, result: CheckResult) -> None:
...
Methods
Internal Methods 1 ▼
__call__
2
▼
__call__
2
▼
def __call__(self, snapshot: ContractCheckSnapshot, result: CheckResult) -> None
Parameters
| Name | Type | Description |
|---|---|---|
snapshot |
— |
|
result |
— |
Severity
0
▼
Severity of a contract validation issue.
Severity
0
▼
Severity of a contract validation issue.
ContractIssue
6
▼
A single validation issue found during contract checking.
ContractIssue
6
▼
A single validation issue found during contract checking.
Attributes
| Name | Type | Description |
|---|---|---|
severity |
Severity
|
— |
category |
str
|
— |
message |
str
|
— |
template |
str | None
|
— |
route |
str | None
|
— |
details |
str | None
|
— |
ContractCoverage
10
▼
High-level coverage counters for serious hypermedia apps.
ContractCoverage
10
▼
High-level coverage counters for serious hypermedia apps.
Attributes
| Name | Type | Description |
|---|---|---|
post_routes |
int
|
— |
post_routes_with_form_contract |
int
|
— |
mounted_page_routes |
int
|
— |
mounted_page_routes_with_contract |
int
|
— |
page_shell_contracts |
int
|
— |
page_shell_required_blocks |
int
|
— |
fragment_targets_registered |
int
|
— |
oob_regions_registered |
int
|
— |
Methods
post_routes_without_form_contract
0
int
▼
POST routes that do not declare a FormContract.
property
post_routes_without_form_contract
0
int
▼
def post_routes_without_form_contract(self) -> int
Returns
int
mounted_page_routes_without_contract
0
int
▼
Mounted page routes whose handlers do not carry any route contract.
property
mounted_page_routes_without_contract
0
int
▼
def mounted_page_routes_without_contract(self) -> int
Returns
int
CheckResult
17
▼
Result of a hypermedia surface check.
CheckResult
17
▼
Result of a hypermedia surface check.
Attributes
| Name | Type | Description |
|---|---|---|
issues |
list[ContractIssue]
|
— |
routes_checked |
int
|
— |
templates_scanned |
int
|
— |
targets_found |
int
|
— |
hx_targets_validated |
int
|
— |
commandfor_validated |
int
|
— |
dead_templates_found |
int
|
— |
sse_fragments_validated |
int
|
— |
forms_validated |
int
|
— |
component_calls_validated |
int
|
— |
page_context_warnings |
int
|
— |
elapsed_ms |
float | None
|
— |
coverage |
ContractCoverage
|
— |
Methods
errors
0
list[ContractIssue]
▼
property
errors
0
list[ContractIssue]
▼
def errors(self) -> list[ContractIssue]
Returns
list[ContractIssue]
warnings
0
list[ContractIssue]
▼
property
warnings
0
list[ContractIssue]
▼
def warnings(self) -> list[ContractIssue]
Returns
list[ContractIssue]
ok
0
bool
▼
property
ok
0
bool
▼
def ok(self) -> bool
Returns
bool
summary
0
str
▼
summary
0
str
▼
def summary(self) -> str
Returns
str