/** * Shared helpers for scanner pattern matching. */ /** * Whether a line is a module import / require statement (ES `import`, * re-export `export … from`, or CommonJS `require(...)`). * * Rules that infer "library X is used" by matching its name should not anchor * a finding to the `import` line — flagging an import statement reads as a false * positive to reviewers. Use this to skip import lines when choosing the line a * finding points at (and to suppress findings whose only evidence is an import). */ export declare function isImportLine(line: string): boolean; /** A violation located at a 0-based line index, plus the anchor line's code. */ export interface WindowedViolation { lineIndex: number; code: string; } export interface WindowedMatchOptions { /** Lines of look-around for multi-line matching and the compliance window. */ windowLines?: number; /** Skip lines that are pure comments (`//`, `#`, `*`, `/*`). */ skipCommentLines?: boolean; /** Don't anchor a violation on an `import`/`require` line (see isImportLine). */ skipImportLines?: boolean; } /** * Match violation patterns against code with two properties the old per-line + * forward-only-window approach lacked: * * (a) MULTI-LINE positives — a pattern's `.*?` may span several lines, so a * violation expressed across a block (e.g. `catch (error) {` on one line * and the security keyword on the next) is detected. Each match is anchored * to the line where it STARTS, so a single multi-line span is reported once. * * (b) BIDIRECTIONAL compliance — negative (compliance) patterns are evaluated * in a window that looks both ABOVE and below the match, so a mitigation * declared earlier in the block (a CORS whitelist, an MFA check, a session * timeout) correctly suppresses the finding. * * Returns the anchor lines (0-based) that should produce a finding. */ export declare function findWindowedViolations(lines: string[], positivePatterns: RegExp[], negativePatterns: RegExp[] | undefined, options?: WindowedMatchOptions): WindowedViolation[]; //# sourceMappingURL=utils.d.ts.map