Skip to main content

is_likely_false_positive

Function is_likely_false_positive 

Source
pub fn is_likely_false_positive(
    text: &str,
    match_start: usize,
    match_end: usize,
) -> bool
Expand description

Check whether a PII match is likely a false positive based on its context.

Returns true (suppress the match) when:

  • The match is inside a fenced code block (```)
  • The match is on an indented code line (4+ spaces or tab)
  • The match is inside a URL (http:// / https://)
  • The matched text is a well-known placeholder or example value

ยงArguments

  • text โ€” the full source text being scanned
  • match_start โ€” byte offset where the match begins
  • match_end โ€” byte offset where the match ends