Skip to content

Commit 963b2f5

Browse files
committed
feat: default severities
1 parent 5a224e1 commit 963b2f5

20 files changed

+313
-310
lines changed

README.md

Lines changed: 72 additions & 72 deletions
Large diffs are not rendered by default.

packages/action/README.md

Lines changed: 73 additions & 72 deletions
Large diffs are not rendered by default.

packages/cli/README.md

Lines changed: 73 additions & 72 deletions
Large diffs are not rendered by default.

packages/core/src/main/libs/exportAsDetails.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function exportDetails(results: ScanResult[], includeDetails = false): Fl
1818
flowFile,
1919
flowName,
2020
ruleName: rule.ruleDefinition.label || rule.ruleName, // TODO: replace with id
21-
severity: rule.severity ?? "error",
21+
severity: rule.severity ?? "warning",
2222
};
2323
return exported;
2424
}));

packages/core/src/main/libs/exportAsSarif.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@ function mapSeverity(sev: string): "error" | "note" | "warning" {
8383
case "info":
8484
case "note": return "note";
8585
case "warning": return "warning";
86-
default: return "error";
86+
default: return "warning";
8787
}
8888
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@ export interface FlatViolation extends Omit<Violation, 'details'> {
55
flowName: string;
66
ruleName: string;
77
severity: string;
8+
dataType?: string;
9+
locationX?: string;
10+
locationY?: string;
11+
connectsTo?: string;
12+
expression?: string;
813
}

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { RuleCommon } from "./RuleCommon";
44
import { RuleInfo } from "./RuleInfo";
55

66
export abstract class LoopRuleCommon extends RuleCommon implements IRuleDefinition {
7-
constructor(info: RuleInfo) {
8-
super(info);
7+
constructor(info: RuleInfo, optional?: { severity?: string }) {
8+
super(info, optional);
99
}
1010

1111
protected check(
@@ -17,12 +17,10 @@ export abstract class LoopRuleCommon extends RuleCommon implements IRuleDefiniti
1717
if (!loopElements.length) {
1818
return [];
1919
}
20-
2120
const statementsInLoops = this.findStatementsInLoops(flow, loopElements);
2221
const results = statementsInLoops
2322
.filter(det => !suppressions.has(det.name))
2423
.map(det => new Violation(det));
25-
2624
return results;
2725
}
2826

@@ -44,12 +42,10 @@ export abstract class LoopRuleCommon extends RuleCommon implements IRuleDefiniti
4442
statementsInLoops.push(element);
4543
}
4644
};
47-
4845
for (const element of loopElements) {
4946
const loopEnd = this.findLoopEnd(element);
5047
new Compiler().traverseFlow(flow, element.name, findStatement, loopEnd);
5148
}
52-
5349
return statementsInLoops;
5450
}
5551
}

packages/core/src/main/rules/ActionCallsInLoop.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ export class ActionCallsInLoop extends LoopRuleCommon implements IRuleDefinition
1515
label: "Action Call In Loop",
1616
name: "ActionCallsInLoop",
1717
supportedTypes: FlowType.backEndTypes,
18-
}
19-
);
18+
}, { severity: "error" });
2019
}
2120
protected getStatementTypes(): string[] {
2221
return ["actionCalls", "apexPluginCalls"];

packages/core/src/main/rules/AutoLayout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export class AutoLayout extends RuleCommon implements IRuleDefinition {
1010
"With Canvas Mode set to Auto-Layout, Elements are spaced, connected, and aligned automatically, keeping your Flow neatly organized thus saving you time.",
1111
supportedTypes: core.FlowType.allTypes(),
1212
docRefs: [],
13-
});
13+
}, { severity: "note" });
1414
}
1515

1616
protected check(

packages/core/src/main/rules/DMLStatementInLoop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class DMLStatementInLoop extends LoopRuleCommon implements IRuleDefinitio
1515
label: "DML Statement In A Loop",
1616
name: "DMLStatementInLoop",
1717
supportedTypes: FlowType.backEndTypes,
18-
});
18+
}, { severity: "error" });
1919
}
2020

2121
protected getStatementTypes(): string[] {

0 commit comments

Comments
 (0)