UNPKG

@felixgeelhaar/cclint

Version:

A comprehensive linter for CLAUDE.md files with multi-language code block validation

45 lines 1.39 kB
import { ContextFile } from './ContextFile.js'; import { Violation } from './Violation.js'; import { Severity } from './Severity.js'; export class LintingResult { file; _violations = []; constructor(file) { this.file = file; } get violations() { return this._violations; } addViolation(violation) { this._violations.push(violation); } hasViolations() { return this._violations.length > 0; } getViolationsByRule(ruleId) { return this._violations.filter(violation => violation.ruleId === ruleId); } getViolationsBySeverity(severity) { return this._violations.filter(violation => violation.severity === severity); } getErrorCount() { return this.getViolationsBySeverity(Severity.ERROR).length; } getWarningCount() { return this.getViolationsBySeverity(Severity.WARNING).length; } getInfoCount() { return this.getViolationsBySeverity(Severity.INFO).length; } getHighestSeverity() { if (this._violations.length === 0) { return Severity.INFO; } return this._violations.reduce((highest, violation) => { return violation.severity.compareTo(highest) > 0 ? violation.severity : highest; }, Severity.INFO); } } //# sourceMappingURL=LintingResult.js.map