25 lines
545 B
TypeScript
25 lines
545 B
TypeScript
/**
|
|
* Guardrail violation representation
|
|
*/
|
|
|
|
export class GuardrailViolation {
|
|
constructor(
|
|
public readonly ruleName: string,
|
|
public readonly filePath: string,
|
|
public readonly lineNumber: number,
|
|
public readonly description: string,
|
|
) {}
|
|
|
|
toString(): string {
|
|
return `${this.filePath}:${this.lineNumber} - ${this.ruleName}: ${this.description}`;
|
|
}
|
|
|
|
toJSON(): object {
|
|
return {
|
|
rule: this.ruleName,
|
|
file: this.filePath,
|
|
line: this.lineNumber,
|
|
description: this.description,
|
|
};
|
|
}
|
|
} |