Skip to main content

Module helpers

Module helpers 

Source

Constants§

CUSTOM_RULE_ID_SEPARATORS
The characters permitted in a custom (CEL/Rego/Guard) rule ID beyond ASCII letters and digits: the identifier separators _, ., and -.

Functions§

category_for_rule_id
Map a rule ID to its diagnostic category based on the ID prefix convention.
format_rule_for_format
Map a CloudFormation schema format string to the rule ID that validates it. Returns None for formats without a dedicated rule.
is_fatal_rule
Returns true if the rule ID indicates a fatal-severity rule (prefix F).
is_valid_custom_rule_id
Returns true if rule_id is a well-formed custom-rule identifier: a non-empty run of ASCII letters, digits, and the separators _, ., or -.
rule_number
Extracts the numeric part of a rule ID (the digits after the severity-prefix letter), used to order diagnostics by rule number within a severity. A rule ID that does not follow the [FEWID]\d+ convention (e.g. a custom rule) yields u32::MAX so it sorts after the well-formed built-in rules.
section_for_rule_id
Derive the top-level CloudFormation template section a rule reports on. Used to fall back to the section’s span when a diagnostic has no more precise location.