@flow-scanner/lightning-flow-scanner-core 6.4.2 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +51 -14
- package/index.d.ts +4 -3
- package/index.js +4 -4
- package/main/interfaces/IRulesConfig.d.ts +6 -0
- package/main/interfaces/IRulesConfig.js +11 -0
- package/main/internals/internals.d.ts +6 -5
- package/main/internals/internals.js +11 -7
- package/main/libs/GetRuleDefinitions.d.ts +1 -1
- package/main/libs/GetRuleDefinitions.js +5 -6
- package/main/libs/ScanFlows.js +29 -3
- package/main/libs/exportAsDetails.d.ts +2 -15
- package/main/libs/exportAsDetails.js +69 -26
- package/main/libs/exportAsSarif.js +19 -18
- package/main/models/FlatViolation.d.ts +7 -0
- package/main/models/Flow.d.ts +18 -10
- package/main/models/Flow.js +82 -61
- package/main/models/LoopRuleCommon.d.ts +2 -2
- package/main/models/LoopRuleCommon.js +8 -10
- package/main/models/RuleCommon.d.ts +14 -2
- package/main/models/RuleCommon.js +16 -3
- package/main/models/RuleResult.d.ts +3 -3
- package/main/models/ScanResult.d.ts +1 -1
- package/main/models/Violation.d.ts +12 -0
- package/main/models/Violation.js +101 -0
- package/main/rules/APIVersion.d.ts +3 -3
- package/main/rules/APIVersion.js +20 -24
- package/main/rules/ActionCallsInLoop.js +1 -1
- package/main/rules/AutoLayout.d.ts +1 -3
- package/main/rules/AutoLayout.js +10 -20
- package/main/rules/CopyAPIName.d.ts +1 -1
- package/main/rules/CopyAPIName.js +4 -13
- package/main/rules/CyclomaticComplexity.d.ts +4 -4
- package/main/rules/CyclomaticComplexity.js +19 -27
- package/main/rules/DuplicateDMLOperation.d.ts +2 -2
- package/main/rules/DuplicateDMLOperation.js +53 -56
- package/main/rules/FlowDescription.d.ts +1 -1
- package/main/rules/FlowDescription.js +8 -12
- package/main/rules/FlowName.d.ts +2 -2
- package/main/rules/FlowName.js +12 -18
- package/main/rules/GetRecordAllFields.d.ts +1 -1
- package/main/rules/GetRecordAllFields.js +11 -21
- package/main/rules/HardcodedId.d.ts +1 -1
- package/main/rules/HardcodedId.js +4 -15
- package/main/rules/HardcodedUrl.d.ts +2 -2
- package/main/rules/HardcodedUrl.js +4 -17
- package/main/rules/InactiveFlow.d.ts +1 -1
- package/main/rules/InactiveFlow.js +7 -10
- package/main/rules/MissingFaultPath.d.ts +1 -1
- package/main/rules/MissingFaultPath.js +22 -24
- package/main/rules/MissingNullHandler.d.ts +1 -1
- package/main/rules/MissingNullHandler.js +67 -70
- package/main/rules/ProcessBuilder.d.ts +1 -3
- package/main/rules/ProcessBuilder.js +4 -8
- package/main/rules/RecursiveAfterUpdate.d.ts +1 -1
- package/main/rules/RecursiveAfterUpdate.js +29 -31
- package/main/rules/SameRecordFieldUpdates.d.ts +1 -1
- package/main/rules/SameRecordFieldUpdates.js +15 -21
- package/main/rules/TriggerOrder.d.ts +1 -1
- package/main/rules/TriggerOrder.js +8 -13
- package/main/rules/UnconnectedElement.d.ts +1 -1
- package/main/rules/UnconnectedElement.js +12 -15
- package/main/rules/UnsafeRunningContext.d.ts +1 -1
- package/main/rules/UnsafeRunningContext.js +12 -13
- package/main/rules/UnusedVariable.d.ts +1 -1
- package/main/rules/UnusedVariable.js +23 -27
- package/main/store/DefaultRuleStore.js +2 -3
- package/package.json +6 -7
- package/main/interfaces/AutoFixable.d.ts +0 -10
- package/main/models/ResultDetails.d.ts +0 -10
- package/main/models/ResultDetails.js +0 -57
- /package/main/{interfaces/AutoFixable.js → models/FlatViolation.js} +0 -0
|
@@ -65,33 +65,25 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
65
65
|
return newObj;
|
|
66
66
|
}
|
|
67
67
|
let CyclomaticComplexity = class CyclomaticComplexity extends _RuleCommon.RuleCommon {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (cyclomaticComplexity > threshold) {
|
|
88
|
-
const detail = new _internals.ResultDetails(new _internals.FlowAttribute(`${cyclomaticComplexity}`, "CyclomaticComplexity", `>${threshold}`));
|
|
89
|
-
if (!suppSet.has(detail.name)) {
|
|
90
|
-
results.push(detail);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return new _internals.RuleResult(this, results);
|
|
94
|
-
});
|
|
68
|
+
check(flow, options) {
|
|
69
|
+
var _flow_elements, _flow_elements1;
|
|
70
|
+
const threshold = (options === null || options === void 0 ? void 0 : options.threshold) || this.defaultThreshold;
|
|
71
|
+
let cyclomaticComplexity = 1;
|
|
72
|
+
const flowDecisions = flow === null || flow === void 0 ? void 0 : (_flow_elements = flow.elements) === null || _flow_elements === void 0 ? void 0 : _flow_elements.filter((node)=>node.subtype === "decisions");
|
|
73
|
+
const flowLoops = flow === null || flow === void 0 ? void 0 : (_flow_elements1 = flow.elements) === null || _flow_elements1 === void 0 ? void 0 : _flow_elements1.filter((node)=>node.subtype === "loops");
|
|
74
|
+
for (const decision of flowDecisions || []){
|
|
75
|
+
const rules = decision.element["rules"];
|
|
76
|
+
cyclomaticComplexity += Array.isArray(rules) ? rules.length + 1 : 1;
|
|
77
|
+
}
|
|
78
|
+
var _flowLoops_length;
|
|
79
|
+
cyclomaticComplexity += (_flowLoops_length = flowLoops === null || flowLoops === void 0 ? void 0 : flowLoops.length) !== null && _flowLoops_length !== void 0 ? _flowLoops_length : 0;
|
|
80
|
+
this.cyclomaticComplexityUnit = cyclomaticComplexity;
|
|
81
|
+
if (cyclomaticComplexity > threshold) {
|
|
82
|
+
return [
|
|
83
|
+
new _internals.Violation(new _internals.FlowAttribute(`${cyclomaticComplexity}`, "CyclomaticComplexity", `>${threshold}`))
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
return [];
|
|
95
87
|
}
|
|
96
88
|
constructor(){
|
|
97
89
|
super({
|
|
@@ -3,7 +3,7 @@ import { RuleCommon } from "../models/RuleCommon";
|
|
|
3
3
|
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
4
|
export declare class DuplicateDMLOperation extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
constructor();
|
|
6
|
-
|
|
7
|
-
private flagDML;
|
|
6
|
+
protected check(flow: core.Flow, _options: object | undefined, suppressions: Set<string>): core.Violation[];
|
|
8
7
|
private findStart;
|
|
8
|
+
private flagDML;
|
|
9
9
|
}
|
|
@@ -52,64 +52,69 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
54
|
let DuplicateDMLOperation = class DuplicateDMLOperation extends _RuleCommon.RuleCommon {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
references.push(connector.reference);
|
|
79
|
-
}
|
|
55
|
+
check(flow, _options, suppressions) {
|
|
56
|
+
const flowElements = flow.elements.filter((node)=>node instanceof _internals.FlowNode);
|
|
57
|
+
const processedElementIndexes = [];
|
|
58
|
+
const unconnectedElementIndexes = [];
|
|
59
|
+
const DuplicateDMLOperations = [];
|
|
60
|
+
const startingNode = this.findStart(flow);
|
|
61
|
+
if (startingNode === -1) {
|
|
62
|
+
return [];
|
|
63
|
+
}
|
|
64
|
+
let dmlFlag = false;
|
|
65
|
+
let indexesToProcess = [
|
|
66
|
+
startingNode
|
|
67
|
+
];
|
|
68
|
+
do {
|
|
69
|
+
indexesToProcess = indexesToProcess.filter((index)=>!processedElementIndexes.includes(index));
|
|
70
|
+
if (indexesToProcess.length > 0) {
|
|
71
|
+
for (const [index, element] of flowElements.entries()){
|
|
72
|
+
if (indexesToProcess.includes(index)) {
|
|
73
|
+
const references = [];
|
|
74
|
+
if (element.connectors && element.connectors.length > 0) {
|
|
75
|
+
for (const connector of element.connectors){
|
|
76
|
+
if (connector.reference) {
|
|
77
|
+
references.push(connector.reference);
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
}
|
|
81
|
+
dmlFlag = this.flagDML(element, dmlFlag);
|
|
82
|
+
if (references.length > 0) {
|
|
83
|
+
const elementsByReferences = flowElements.filter((el)=>references.includes(el.name));
|
|
84
|
+
for (const nextElement of elementsByReferences){
|
|
85
|
+
const nextIndex = flowElements.findIndex((el)=>nextElement.name === el.name);
|
|
86
|
+
if (nextElement.subtype === "screens") {
|
|
87
|
+
if (dmlFlag && nextElement.element["allowBack"] === "true" && nextElement.element["showFooter"] === "true") {
|
|
88
|
+
if (!suppressions.has(nextElement.name)) {
|
|
89
|
+
DuplicateDMLOperations.push(nextElement);
|
|
92
90
|
}
|
|
93
91
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
}
|
|
93
|
+
if (!processedElementIndexes.includes(nextIndex)) {
|
|
94
|
+
indexesToProcess.push(nextIndex);
|
|
97
95
|
}
|
|
98
96
|
}
|
|
99
|
-
processedElementIndexes.push(index);
|
|
100
97
|
}
|
|
98
|
+
processedElementIndexes.push(index);
|
|
101
99
|
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
for (const index of flowElements.keys()){
|
|
103
|
+
if (!processedElementIndexes.includes(index)) {
|
|
104
|
+
unconnectedElementIndexes.push(index);
|
|
107
105
|
}
|
|
108
106
|
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
}
|
|
108
|
+
}while (processedElementIndexes.length + unconnectedElementIndexes.length < flowElements.length)
|
|
109
|
+
return DuplicateDMLOperations.map((det)=>new _internals.Violation(det));
|
|
110
|
+
}
|
|
111
|
+
findStart(flow) {
|
|
112
|
+
const flowElements = flow.elements.filter((node)=>node instanceof _internals.FlowNode);
|
|
113
|
+
if (flow.startElementReference) {
|
|
114
|
+
return flowElements.findIndex((n)=>n.name === flow.startElementReference);
|
|
115
|
+
} else {
|
|
116
|
+
return flowElements.findIndex((n)=>n.subtype === "start");
|
|
117
|
+
}
|
|
113
118
|
}
|
|
114
119
|
flagDML(element, dmlFlag) {
|
|
115
120
|
const dmlStatementTypes = [
|
|
@@ -125,14 +130,6 @@ let DuplicateDMLOperation = class DuplicateDMLOperation extends _RuleCommon.Rule
|
|
|
125
130
|
return dmlFlag;
|
|
126
131
|
}
|
|
127
132
|
}
|
|
128
|
-
findStart(flow) {
|
|
129
|
-
const flowElements = flow.elements.filter((node)=>node instanceof _internals.FlowNode);
|
|
130
|
-
if (flow.startElementReference) {
|
|
131
|
-
return flowElements.findIndex((n)=>n.name === flow.startElementReference);
|
|
132
|
-
} else {
|
|
133
|
-
return flowElements.findIndex((n)=>n.subtype === "start");
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
133
|
constructor(){
|
|
137
134
|
super({
|
|
138
135
|
name: "DuplicateDMLOperation",
|
|
@@ -3,5 +3,5 @@ import { RuleCommon } from "../models/RuleCommon";
|
|
|
3
3
|
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
4
|
export declare class FlowDescription extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
constructor();
|
|
6
|
-
|
|
6
|
+
protected check(flow: core.Flow, _options: object | undefined, _suppressions: Set<string>): core.Violation[];
|
|
7
7
|
}
|
|
@@ -52,18 +52,14 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
54
|
let FlowDescription = class FlowDescription extends _RuleCommon.RuleCommon {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return new _internals.RuleResult(this, [
|
|
64
|
-
detail
|
|
65
|
-
]);
|
|
66
|
-
});
|
|
55
|
+
check(flow, _options, _suppressions) {
|
|
56
|
+
var _flow_xmldata;
|
|
57
|
+
if ((_flow_xmldata = flow.xmldata) === null || _flow_xmldata === void 0 ? void 0 : _flow_xmldata.description) {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
return [
|
|
61
|
+
new _internals.Violation(new _internals.FlowAttribute("undefined", "description", "!==null"))
|
|
62
|
+
];
|
|
67
63
|
}
|
|
68
64
|
constructor(){
|
|
69
65
|
super({
|
package/main/rules/FlowName.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { RuleCommon } from "../models/RuleCommon";
|
|
|
3
3
|
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
4
|
export declare class FlowName extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
constructor();
|
|
6
|
-
|
|
6
|
+
protected check(flow: core.Flow, options: {
|
|
7
7
|
expression?: string;
|
|
8
|
-
},
|
|
8
|
+
} | undefined, _suppressions: Set<string>): core.Violation[];
|
|
9
9
|
}
|
package/main/rules/FlowName.js
CHANGED
|
@@ -52,23 +52,17 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
54
|
let FlowName = class FlowName extends _RuleCommon.RuleCommon {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return new _internals.RuleResult(this, []);
|
|
67
|
-
}
|
|
68
|
-
return new _internals.RuleResult(this, [
|
|
69
|
-
detail
|
|
70
|
-
]);
|
|
71
|
-
});
|
|
55
|
+
check(flow, options, _suppressions) {
|
|
56
|
+
var _options_expression;
|
|
57
|
+
const rawRegexp = (_options_expression = options === null || options === void 0 ? void 0 : options.expression) !== null && _options_expression !== void 0 ? _options_expression : "[A-Za-z0-9]+_[A-Za-z0-9]+";
|
|
58
|
+
var _flow_name;
|
|
59
|
+
const flowName = (_flow_name = flow.name) !== null && _flow_name !== void 0 ? _flow_name : "";
|
|
60
|
+
if (new RegExp(rawRegexp).test(flowName)) {
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
return [
|
|
64
|
+
new _internals.Violation(new _internals.FlowAttribute(flowName, "name", rawRegexp))
|
|
65
|
+
];
|
|
72
66
|
}
|
|
73
67
|
constructor(){
|
|
74
68
|
super({
|
|
@@ -77,7 +71,7 @@ let FlowName = class FlowName extends _RuleCommon.RuleCommon {
|
|
|
77
71
|
docRefs: [
|
|
78
72
|
{
|
|
79
73
|
label: "Naming your Flows is more critical than ever. By Stephen Church",
|
|
80
|
-
path: "https://www.linkedin.com/posts/stephen-n-church_naming-your-flows-this-is-more-critical-activity-7099733198175158274-1sPx
|
|
74
|
+
path: "https://www.linkedin.com/posts/stephen-n-church_naming-your-flows-this-is-more-critical-activity-7099733198175158274-1sPx"
|
|
81
75
|
}
|
|
82
76
|
],
|
|
83
77
|
isConfigurable: true,
|
|
@@ -3,5 +3,5 @@ import { RuleCommon } from "../models/RuleCommon";
|
|
|
3
3
|
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
4
|
export declare class GetRecordAllFields extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
constructor();
|
|
6
|
-
|
|
6
|
+
protected check(flow: core.Flow, _options: object | undefined, _suppressions: Set<string>): core.Violation[];
|
|
7
7
|
}
|
|
@@ -52,27 +52,17 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
54
|
let GetRecordAllFields = class GetRecordAllFields extends _RuleCommon.RuleCommon {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (!hasQualifiedElementDefinition) return false;
|
|
67
|
-
const concreteChildElement = getRecordElement.element;
|
|
68
|
-
const storeAllFields = "storeOutputAutomatically" in concreteChildElement && concreteChildElement["storeOutputAutomatically"];
|
|
69
|
-
const hasQueriedFields = "queriedFields" in concreteChildElement && Array.isArray(concreteChildElement["queriedFields"]) && concreteChildElement["queriedFields"].length > 0;
|
|
70
|
-
const isViolation = storeAllFields && !hasQueriedFields;
|
|
71
|
-
return isViolation && !suppSet.has(getRecordElement.name);
|
|
72
|
-
}).map((element)=>new _internals.ResultDetails(element));
|
|
73
|
-
results.push(...errorNodes);
|
|
74
|
-
return new _internals.RuleResult(this, results);
|
|
75
|
-
});
|
|
55
|
+
check(flow, _options, _suppressions) {
|
|
56
|
+
var _flow_elements;
|
|
57
|
+
var _flow_elements_filter;
|
|
58
|
+
const lookupNodes = (_flow_elements_filter = (_flow_elements = flow.elements) === null || _flow_elements === void 0 ? void 0 : _flow_elements.filter((e)=>e.subtype === "recordLookups")) !== null && _flow_elements_filter !== void 0 ? _flow_elements_filter : [];
|
|
59
|
+
const violations = lookupNodes.filter((node)=>{
|
|
60
|
+
const el = node.element;
|
|
61
|
+
const storeAllFields = typeof el === "object" && "storeOutputAutomatically" in el && el.storeOutputAutomatically;
|
|
62
|
+
const hasQueriedFields = typeof el === "object" && Array.isArray(el.queriedFields) && el.queriedFields.length > 0;
|
|
63
|
+
return storeAllFields && !hasQueriedFields;
|
|
64
|
+
}).map((node)=>new _internals.Violation(node));
|
|
65
|
+
return violations;
|
|
76
66
|
}
|
|
77
67
|
constructor(){
|
|
78
68
|
super({
|
|
@@ -3,5 +3,5 @@ import { RuleCommon } from "../models/RuleCommon";
|
|
|
3
3
|
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
4
|
export declare class HardcodedId extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
constructor();
|
|
6
|
-
|
|
6
|
+
protected check(flow: core.Flow, _options: object | undefined, _suppressions: Set<string>): core.Violation[];
|
|
7
7
|
}
|
|
@@ -52,20 +52,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
54
|
let HardcodedId = class HardcodedId extends _RuleCommon.RuleCommon {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const results = [];
|
|
59
|
-
for (const node of flow.elements){
|
|
60
|
-
const nodeString = JSON.stringify(node);
|
|
61
|
-
if (salesforceIdRegex.test(nodeString)) {
|
|
62
|
-
if (!suppSet.has(node.name)) {
|
|
63
|
-
results.push(new _internals.ResultDetails(node));
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return new _internals.RuleResult(this, results);
|
|
68
|
-
});
|
|
55
|
+
check(flow, _options, _suppressions) {
|
|
56
|
+
const salesforceIdRegex = /\b[a-zA-Z0-9]{5}0[a-zA-Z0-9]{9}(?:[a-zA-Z0-9]{3})?\b/g;
|
|
57
|
+
return flow.elements.filter((node)=>salesforceIdRegex.test(JSON.stringify(node))).map((node)=>new _internals.Violation(node));
|
|
69
58
|
}
|
|
70
59
|
constructor(){
|
|
71
60
|
super({
|
|
@@ -80,7 +69,7 @@ let HardcodedId = class HardcodedId extends _RuleCommon.RuleCommon {
|
|
|
80
69
|
},
|
|
81
70
|
{
|
|
82
71
|
label: "Don't hard code Record Type IDs in Flow. By Stephen Church.",
|
|
83
|
-
path: "https://www.linkedin.com/feed/update/urn:li:activity:6947530300012826624
|
|
72
|
+
path: "https://www.linkedin.com/feed/update/urn:li:activity:6947530300012826624/"
|
|
84
73
|
}
|
|
85
74
|
],
|
|
86
75
|
isConfigurable: false,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Flow,
|
|
1
|
+
import { Flow, Violation } from "../internals/internals";
|
|
2
2
|
import { RuleCommon } from "../models/RuleCommon";
|
|
3
3
|
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
4
|
export declare class HardcodedUrl extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
constructor();
|
|
6
|
-
|
|
6
|
+
protected check(flow: Flow, _options: object | undefined, _suppressions: Set<string>): Violation[];
|
|
7
7
|
}
|
|
@@ -11,23 +11,10 @@ Object.defineProperty(exports, "HardcodedUrl", {
|
|
|
11
11
|
const _internals = require("../internals/internals");
|
|
12
12
|
const _RuleCommon = require("../models/RuleCommon");
|
|
13
13
|
let HardcodedUrl = class HardcodedUrl extends _RuleCommon.RuleCommon {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return new _internals.RuleResult(this, results);
|
|
19
|
-
}
|
|
20
|
-
const urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}force\.com/g;
|
|
21
|
-
for (const element of flow.elements){
|
|
22
|
-
const nodeString = JSON.stringify(element);
|
|
23
|
-
if (urlRegex.test(nodeString)) {
|
|
24
|
-
if (!suppSet.has(element.name)) {
|
|
25
|
-
results.push(new _internals.ResultDetails(element));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return new _internals.RuleResult(this, results);
|
|
30
|
-
});
|
|
14
|
+
check(flow, _options, _suppressions) {
|
|
15
|
+
if (!flow.elements || flow.elements.length === 0) return [];
|
|
16
|
+
const urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}force\.com/g;
|
|
17
|
+
return flow.elements.filter((element)=>urlRegex.test(JSON.stringify(element))).map((element)=>new _internals.Violation(element));
|
|
31
18
|
}
|
|
32
19
|
constructor(){
|
|
33
20
|
super({
|
|
@@ -3,5 +3,5 @@ import { RuleCommon } from "../models/RuleCommon";
|
|
|
3
3
|
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
4
|
export declare class InactiveFlow extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
constructor();
|
|
6
|
-
|
|
6
|
+
protected check(flow: core.Flow, _options: object | undefined, _suppressions: Set<string>): core.Violation[];
|
|
7
7
|
}
|
|
@@ -52,16 +52,13 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
52
52
|
return newObj;
|
|
53
53
|
}
|
|
54
54
|
let InactiveFlow = class InactiveFlow extends _RuleCommon.RuleCommon {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
return new _internals.RuleResult(this, results);
|
|
64
|
-
});
|
|
55
|
+
check(flow, _options, _suppressions) {
|
|
56
|
+
if (flow.status !== "Active") {
|
|
57
|
+
return [
|
|
58
|
+
new _internals.Violation(new _internals.FlowAttribute(flow.status, "status", "!= Active"))
|
|
59
|
+
];
|
|
60
|
+
}
|
|
61
|
+
return [];
|
|
65
62
|
}
|
|
66
63
|
constructor(){
|
|
67
64
|
super({
|
|
@@ -5,6 +5,6 @@ export declare class MissingFaultPath extends RuleCommon implements IRuleDefinit
|
|
|
5
5
|
protected applicableElements: string[];
|
|
6
6
|
constructor();
|
|
7
7
|
private isValidSubtype;
|
|
8
|
-
|
|
8
|
+
protected check(flow: core.Flow, _options: object | undefined, suppressions: Set<string>): core.Violation[];
|
|
9
9
|
private isPartOfFaultHandlingFlow;
|
|
10
10
|
}
|
|
@@ -80,32 +80,30 @@ let MissingFaultPath = class MissingFaultPath extends _RuleCommon.RuleCommon {
|
|
|
80
80
|
}
|
|
81
81
|
return true;
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if (!
|
|
100
|
-
|
|
101
|
-
results.push(new _internals.ResultDetails(element));
|
|
102
|
-
}
|
|
83
|
+
check(flow, _options, suppressions) {
|
|
84
|
+
var _flow_elements;
|
|
85
|
+
const compiler = new _internals.Compiler();
|
|
86
|
+
const results = [];
|
|
87
|
+
const elementsWhereFaultPathIsApplicable = ((_flow_elements = flow.elements) === null || _flow_elements === void 0 ? void 0 : _flow_elements.filter((node)=>{
|
|
88
|
+
const proxyNode = node;
|
|
89
|
+
return this.isValidSubtype(proxyNode);
|
|
90
|
+
})).map((e)=>e.name);
|
|
91
|
+
const isRecordBeforeSave = flow.start.triggerType === "RecordBeforeSave";
|
|
92
|
+
const visitCallback = (element)=>{
|
|
93
|
+
var _element_connectors;
|
|
94
|
+
if (!(element === null || element === void 0 ? void 0 : (_element_connectors = element.connectors) === null || _element_connectors === void 0 ? void 0 : _element_connectors.find((connector)=>connector.type === "faultConnector")) && elementsWhereFaultPathIsApplicable.includes(element.name)) {
|
|
95
|
+
if (isRecordBeforeSave && element.subtype === "recordUpdates") {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
if (!this.isPartOfFaultHandlingFlow(element, flow)) {
|
|
99
|
+
if (!suppressions.has(element.name)) {
|
|
100
|
+
results.push(new _internals.Violation(element));
|
|
103
101
|
}
|
|
104
102
|
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
compiler.traverseFlow(flow, flow.startReference, visitCallback);
|
|
106
|
+
return results;
|
|
109
107
|
}
|
|
110
108
|
isPartOfFaultHandlingFlow(element, flow) {
|
|
111
109
|
var _flow_elements;
|
|
@@ -3,5 +3,5 @@ import { RuleCommon } from "../models/RuleCommon";
|
|
|
3
3
|
import { IRuleDefinition } from "../interfaces/IRuleDefinition";
|
|
4
4
|
export declare class MissingNullHandler extends RuleCommon implements IRuleDefinition {
|
|
5
5
|
constructor();
|
|
6
|
-
|
|
6
|
+
protected check(flow: core.Flow, _options: object | undefined, suppressions: Set<string>): core.Violation[];
|
|
7
7
|
}
|