module

NoirAIContext::PatternMatcher

Stateless detection engine. Given a callee / parameter name and/or a source snippet, matches them against PatternDefinition sets and produces AIContextEntry hits. Pure functions — no per-run state — so Builder invokes them as module methods.

Constants

MAX_LABEL_CHARS = 64

Maximum length of an AI-context display label before it is compacted or truncated.

Instance methods

detect_from_patterns(name : String, snippet : String | Nil, patterns : Array(PatternDefinition), path : String | Nil, line : Int32 | Nil, source : String) : AIContextEntry | Nil
Source
detect_single_pattern(pattern : PatternDefinition, name : String, snippet : String | Nil, path : String | Nil, line : Int32 | Nil, source : String) : AIContextEntry | Nil

Single-pattern variant of detect_from_patterns. Pulled out so add_source_scan_entries can iterate every sink/validator pattern independently (one match per kind), where the legacy behaviour stopped at the first match across the whole list.

Source
matches_any?(name : String, patterns : Array(Regex)) : Bool
Source