Skip to content

Commit 5a224e1

Browse files
committed
chore(core): Implement enums in Violation
1 parent 7f5917b commit 5a224e1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/core/src/main/models/Violation.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { MetaType } from "../enums/MetadataTypes";
12
import { Flow } from "./Flow";
23
import { FlowAttribute } from "./FlowAttribute";
34
import { FlowElement } from "./FlowElement";
@@ -20,17 +21,17 @@ export class Violation {
2021
this.columnNumber = 1; // Default; will be overwritten by enrich if found
2122

2223
// Conditionally populate details only if needed (e.g., via config flag later)
23-
if (violation.metaType === "variable") {
24+
if (violation.metaType === MetaType.VARIABLE) {
2425
const element = violation as FlowVariable;
2526
this.details = { dataType: element.dataType };
26-
} else if (violation.metaType === "node") {
27+
} else if (violation.metaType === MetaType.NODE) {
2728
const element = violation as FlowNode;
2829
this.details = {
2930
connectsTo: element.connectors?.map((connector) => connector.reference),
3031
locationX: element.locationX,
3132
locationY: element.locationY,
3233
};
33-
} else if (violation.metaType === "attribute") {
34+
} else if (violation.metaType === MetaType.ATTRIBUTE) {
3435
const element = violation as FlowAttribute;
3536
this.details = { expression: element.expression };
3637
}
@@ -48,7 +49,7 @@ export function enrichViolationsWithLineNumbers(
4849
const flowLevelTags = Flow.ATTRIBUTE_TAGS;
4950
for (const violation of violations) {
5051
// For flow elements (nodes, variables, resources), search by <name> tag
51-
if (violation.metaType !== 'attribute') {
52+
if (violation.metaType !== MetaType.ATTRIBUTE) {
5253
for (let i = 0; i < lines.length; i++) {
5354
if (lines[i].includes(`<name>${violation.name}</name>`)) {
5455
violation.lineNumber = i + 1;
@@ -57,9 +58,8 @@ export function enrichViolationsWithLineNumbers(
5758
}
5859
}
5960
}
60-
6161
// For flow-level attributes, search by the XML tag if it exists
62-
if (violation.metaType === 'attribute') {
62+
if (violation.metaType === MetaType.ATTRIBUTE) {
6363
const tagName = violation.type;
6464

6565
// Only search if it's an actual XML tag (type assertion for literal check)

0 commit comments

Comments
 (0)