Linting API¶
Static analysis of state machine definitions — detect unreachable states, dead ends, nondeterminism, and missing guard/action registrations.
See Linting guide for the full guide with CI integration examples.
Functions¶
lint
¶
lint(machine: StateMachine) -> list[LintWarning]
Run all lint checks on a state machine. Returns a list of warnings.
Source code in src/pystator/lint.py
Data classes and enumerations¶
LintSeverity
¶
Bases: str, Enum
LintWarning
dataclass
¶
LintWarning(code: str, severity: LintSeverity, message: str, context: dict[str, Any])
A single lint finding.
Attributes:
| Name | Type | Description |
|---|---|---|
code |
str
|
Machine-readable code (e.g., |
severity |
LintSeverity
|
ERROR, WARNING, or INFO. |
message |
str
|
Human-readable description. |
context |
dict[str, Any]
|
Extra structured data about the finding. |
Lint check codes¶
| Code | Severity | Description |
|---|---|---|
unreachable_state |
WARNING | State cannot be reached from the initial state |
dead_end |
WARNING | Non-terminal state with no outbound transitions |
dead_transition |
WARNING | Transition shadowed by a higher-priority transition |
nondeterministic |
WARNING | Multiple unguarded transitions with the same trigger |
missing_guard |
WARNING | Guard name referenced but not registered |
missing_action |
WARNING | Action name referenced but not registered |
Import¶
from pystator.lint import lint, LintWarning, LintSeverity
# Or from the top-level package
from pystator import lint, LintWarning
See also¶
- Linting guide
- Visualization — generate diagrams