Skip to main content

rules_hash

Function rules_hash 

Source
pub fn rules_hash(rules: &[Rule]) -> String
Expand description

Compute a stable hash of the active rules by sorting them by id and hashing each rule’s serialized body along with the scanner’s own version.

The body is mixed in so editing a rule (custom or builtin) invalidates the cache even when its id is unchanged. CARGO_PKG_VERSION is mixed in because findings also depend on the scanner’s built-in logic (metric computation, test-path detection, cross-file passes): a new binary must drop stale entries even when the rules are byte-for-byte identical.