Skip to content

Commit 8964d1f

Browse files
committed
chore: refactor rule definition to only use advanced rule c
1 parent 4c04281 commit 8964d1f

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/main/rules/CopyAPIName.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import * as core from "../internals/internals";
22
import { AdvancedRule } from "../models/AdvancedRule";
33

4-
export class CopyAPIName extends AdvancedRule implements core.IRuleDefinition {
4+
export class CopyAPIName extends AdvancedRule {
55
constructor() {
66
super({
7-
name: "CopyAPIName",
8-
label: "Copy API Name",
7+
autoFixable: false,
98
description:
109
"Maintaining multiple elements with a similar name, like 'Copy_X_Of_Element,' can diminish the overall readability of your Flow. When copying and pasting these elements, it's crucial to remember to update the API name of the newly created copy.",
11-
supportedTypes: core.FlowType.allTypes(),
1210
docRefs: [],
1311
isConfigurable: false,
14-
autoFixable: false,
12+
label: "Copy API Name",
13+
name: "CopyAPIName",
14+
supportedTypes: core.FlowType.allTypes(),
1515
});
1616
}
1717

src/main/rules/CyclomaticComplexity.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
import { AdvancedRule } from "../models/AdvancedRule";
21
import * as core from "../internals/internals";
2+
import { AdvancedRule } from "../models/AdvancedRule";
3+
4+
export class CyclomaticComplexity extends AdvancedRule {
5+
private cyclomaticComplexityUnit: number = 0;
6+
7+
private defaultThreshold: number = 25;
38

4-
export class CyclomaticComplexity extends AdvancedRule implements core.IRuleDefinition {
59
constructor() {
610
super(
711
{
8-
name: "CyclomaticComplexity",
9-
label: "Cyclomatic Complexity",
12+
autoFixable: false,
1013
description: `The number of loops and decision rules, plus the number of decisions. Use a combination of 1) subflows and 2) breaking flows into multiple concise trigger ordered flows, to reduce the cyclomatic complexity within a single flow, ensuring maintainability and simplicity.`,
11-
supportedTypes: core.FlowType.backEndTypes,
1214
docRefs: [
1315
{
1416
label: `Cyclomatic complexity is a software metric used to indicate the complexity of a program. It is a quantitative measure of the number of linearly independent paths through a program's source code.`,
1517
path: "https://en.wikipedia.org/wiki/Cyclomatic_complexity",
1618
},
1719
],
1820
isConfigurable: true,
19-
autoFixable: false,
21+
label: "Cyclomatic Complexity",
22+
name: "CyclomaticComplexity",
23+
supportedTypes: core.FlowType.backEndTypes,
2024
},
2125
{ severity: "note" }
2226
);
2327
}
2428

25-
private defaultThreshold: number = 25;
26-
27-
private cyclomaticComplexityUnit: number = 0;
28-
2929
public execute(flow: core.Flow, options?: { threshold: number }): core.RuleResult {
3030
// Set Threshold
3131
const threshold = options?.threshold || this.defaultThreshold;

0 commit comments

Comments
 (0)