UNPKG

vibe-guard

Version:

🛡️ Vibe-Guard Security Scanner - Catch security issues before they catch you!

38 lines 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseRule = void 0; class BaseRule { createIssue(file, line, column, code, message, suggestion, severity) { return { rule: this.name, severity: severity || this.severity, message, file, line, column, code: code.trim(), suggestion }; } findMatches(content, pattern) { const lines = content.split('\n'); const matches = []; lines.forEach((lineContent, lineIndex) => { let match; const globalPattern = new RegExp(pattern.source, pattern.flags.includes('g') ? pattern.flags : pattern.flags + 'g'); while ((match = globalPattern.exec(lineContent)) !== null) { matches.push({ match, line: lineIndex + 1, column: (match.index ?? 0) + 1, lineContent }); if (!pattern.flags.includes('g')) break; } }); return matches; } } exports.BaseRule = BaseRule; //# sourceMappingURL=index.js.map