module NoirAIContext::PatternMatcher

Overview

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.

Extended Modules

Defined in:

ai_context/pattern_matcher.cr

Instance Method Summary

Instance Method Detail

def detect_from_patterns(name : String, snippet : String | Nil, patterns : Array(PatternDefinition), path : String | Nil, line : Int32 | Nil, source : String) : AIContextEntry | Nil #

[View source]
def 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.


[View source]
def matches_any?(name : String, patterns : Array(Regex)) : Bool #

[View source]