@flow-scanner/lightning-flow-scanner-core 6.13.2 → 6.14.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 +233 -189
- package/main/interfaces/IRulesConfig.d.ts +1 -0
- package/main/libs/ScanFlows.js +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
- [Configure Severity Levels](#configure-severity-levels)
|
|
37
37
|
- [Overwrite Expressions](#overwrite-expressions)
|
|
38
38
|
- [Define Exceptions](#define-exceptions)
|
|
39
|
+
- [Exclude Flows from Scanning](#exclude-flows-from-scanning)
|
|
39
40
|
- [Scan Modes](#scan-modes)
|
|
40
41
|
- **[Installation](#installation)**
|
|
41
42
|
- [Distributions](#distributions)
|
|
@@ -52,195 +53,195 @@
|
|
|
52
53
|
|
|
53
54
|
> Want to code a new rule? → See [How to Write a Rule](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/docs/write-a-rule.md)
|
|
54
55
|
|
|
55
|
-
<!-- START GENERATED_RULES -->
|
|
56
|
-
### Action Call In A Loop
|
|
57
|
-
To prevent exceeding Apex governor limits, it is advisable to consolidate and bulkify your apex calls, utilizing a single action call containing a collection variable at the end of the loop.
|
|
58
|
-
|
|
59
|
-
**Rule ID:** `action-call-in-loop`
|
|
60
|
-
**Class Name:** _[ActionCallsInLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/ActionCallsInLoop.ts)_
|
|
61
|
-
**Severity:** 🔴 *Error*
|
|
62
|
-
|
|
63
|
-
### DML Statement In A Loop
|
|
64
|
-
To prevent exceeding Apex governor limits, consolidate all your database operations—record creation, updates, or deletions—at the conclusion of the flow.
|
|
65
|
-
|
|
66
|
-
**Rule ID:** `dml-in-loop`
|
|
67
|
-
**Class Name:** _[DMLStatementInLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/DMLStatementInLoop.ts)_
|
|
68
|
-
**Severity:** 🔴 *Error*
|
|
69
|
-
|
|
70
|
-
### Duplicate DML Operation
|
|
71
|
-
When a flow executes database changes or actions between two screens, prevent users from navigating backward between screens; otherwise, duplicate database operations may be performed.
|
|
72
|
-
|
|
73
|
-
**Rule ID:** `duplicate-dml`
|
|
74
|
-
**Class Name:** _[DuplicateDMLOperation](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/DuplicateDMLOperation.ts)_
|
|
75
|
-
**Severity:** 🟡 *Warning*
|
|
76
|
-
|
|
77
|
-
### Excessive Cyclomatic Complexity
|
|
78
|
-
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.
|
|
79
|
-
|
|
80
|
-
**Rule ID:** `excessive-cyclomatic-complexity`
|
|
81
|
-
**Class Name:** _[CyclomaticComplexity](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/CyclomaticComplexity.ts)_
|
|
82
|
-
**Severity:** 🔵 *Note*
|
|
83
|
-
|
|
84
|
-
### Flow Naming Convention
|
|
85
|
-
The readability of a flow is paramount. Establishing a naming convention significantly enhances findability, searchability, and overall consistency. Include at least a domain and a brief description of the flow’s actions, for example `Service_OrderFulfillment`.
|
|
86
|
-
|
|
87
|
-
**Rule ID:** `invalid-naming-convention`
|
|
88
|
-
**Class Name:** _[FlowName](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/FlowName.ts)_
|
|
89
|
-
**Severity:** 🔴 *Error*
|
|
90
|
-
|
|
91
|
-
### Get Record All Fields
|
|
92
|
-
Following the principle of least privilege (PoLP), avoid using **Get Records** with “Automatically store all fields” unless necessary.
|
|
93
|
-
|
|
94
|
-
**Rule ID:** `get-record-all-fields`
|
|
95
|
-
**Class Name:** _[GetRecordAllFields](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/GetRecordAllFields.ts)_
|
|
96
|
-
**Severity:** 🟡 *Warning*
|
|
97
|
-
|
|
98
|
-
### Hardcoded Id
|
|
99
|
-
Avoid hard-coding IDs because they are org specific. Instead, pass them into variables at the start of the flow—via merge-field URL parameters or a **Get Records** element.
|
|
100
|
-
|
|
101
|
-
**Rule ID:** `hardcoded-id`
|
|
102
|
-
**Class Name:** _[HardcodedId](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/HardcodedId.ts)_
|
|
103
|
-
**Severity:** 🔴 *Error*
|
|
104
|
-
|
|
105
|
-
### Hardcoded Url
|
|
106
|
-
Avoid hard-coding URLs because they are environment specific. Use an `$API` formula (preferred) or environment-specific sources like custom labels, metadata, or settings.
|
|
107
|
-
|
|
108
|
-
**Rule ID:** `hardcoded-url`
|
|
109
|
-
**Class Name:** _[HardcodedUrl](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/HardcodedUrl.ts)_
|
|
110
|
-
**Severity:** 🔴 *Error*
|
|
111
|
-
|
|
112
|
-
### Inactive Flow
|
|
113
|
-
Like cleaning out your closet: deleting unused flows is essential. Inactive flows can still cause trouble—such as accidentally deleting records during testing, or being activated as subflows.
|
|
114
|
-
|
|
115
|
-
**Rule ID:** `inactive-flow`
|
|
116
|
-
**Class Name:** _[InactiveFlow](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/InactiveFlow.ts)_
|
|
117
|
-
**Severity:** 🟡 *Warning*
|
|
118
|
-
|
|
119
|
-
### Invalid API Version
|
|
120
|
-
Introducing newer API components may lead to unexpected issues with older versions of Flows, as they might not align with the underlying mechanics. Starting from API version 50.0, the **Api Version** attribute has been readily available on the Flow Object. To ensure smooth operation and reduce discrepancies between API versions, it is strongly advised to regularly update and maintain them.
|
|
121
|
-
|
|
122
|
-
**Rule ID:** `invalid-api-version`
|
|
123
|
-
**Class Name:** _[APIVersion](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/APIVersion.ts)_
|
|
124
|
-
**Severity:** 🟡 *Warning*
|
|
125
|
-
|
|
126
|
-
### Missing Auto Layout
|
|
127
|
-
With Canvas Mode set to Auto-Layout, elements are spaced, connected, and aligned automatically, keeping your Flow neatly organized—saving you time.
|
|
128
|
-
|
|
129
|
-
**Rule ID:** `missing-auto-layout`
|
|
130
|
-
**Class Name:** _[AutoLayout](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/AutoLayout.ts)_
|
|
131
|
-
**Severity:** 🔵 *Note*
|
|
132
|
-
|
|
133
|
-
### Missing Fault Path
|
|
134
|
-
A flow may fail to execute an operation as intended. By default, the flow displays an error to the user and emails the creator. Customize this behavior by incorporating a Fault Path.
|
|
135
|
-
|
|
136
|
-
**Rule ID:** `missing-fault-path`
|
|
137
|
-
**Class Name:** _[MissingFaultPath](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingFaultPath.ts)_
|
|
138
|
-
**Severity:** 🟡 *Warning*
|
|
139
|
-
|
|
140
|
-
### Missing Filter Record Trigger 
|
|
141
|
-
Record-triggered flows that lack filters on changed fields or entry conditions can lead to unnecessary executions on every record change. This may degrade system performance, hit governor limits faster, and increase resource consumption in high-volume orgs.
|
|
142
|
-
|
|
143
|
-
**Rule ID:** `missing-record-trigger-filter`
|
|
144
|
-
**Class Name:** _[MissingFilterRecordTrigger](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingFilterRecordTrigger.ts)_
|
|
145
|
-
**Severity:** 🟡 *Warning*
|
|
146
|
-
|
|
147
|
-
### Missing Flow Description
|
|
148
|
-
Descriptions play a vital role in documentation. It is highly recommended to include details about where a flow is used and its intended purpose.
|
|
149
|
-
|
|
150
|
-
**Rule ID:** `missing-flow-description`
|
|
151
|
-
**Class Name:** _[FlowDescription](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/FlowDescription.ts)_
|
|
152
|
-
**Severity:** 🔴 *Error*
|
|
153
|
-
|
|
154
|
-
### Missing Metadata Description 
|
|
155
|
-
Flags Flow elements (Get Records, Assignments, Decisions, Actions, etc.) and metadata components (Variables, Formulas, Constants, Text Templates) that lack a description. Adding concise descriptions greatly improves readability, maintainability, and helps AI tools understand your automation intent.
|
|
156
|
-
|
|
157
|
-
**Rule ID:** `missing-metadata-description`
|
|
158
|
-
**Class Name:** _[MissingMetadataDescription](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingMetadataDescription.ts)_
|
|
159
|
-
**Severity:** 🔴 *Error*
|
|
160
|
-
|
|
161
|
-
### Missing Null Handler
|
|
162
|
-
When a **Get Records** operation finds no data, it returns `null`. Validate data by using a Decision element to check for a non-null result.
|
|
163
|
-
|
|
164
|
-
**Rule ID:** `missing-null-handler`
|
|
165
|
-
**Class Name:** _[MissingNullHandler](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingNullHandler.ts)_
|
|
166
|
-
**Severity:** 🟡 *Warning*
|
|
167
|
-
|
|
168
|
-
### Missing Trigger Order
|
|
169
|
-
Guarantee your flow execution order with the **Trigger Order** property introduced in Spring '22.value to their flows and guarantee their execution order. This priority value is not an absolute value, so the values need not be sequentially numbered as 1, 2, 3, and so on.
|
|
170
|
-
|
|
171
|
-
**Rule ID:** `unspecified-trigger-order`
|
|
172
|
-
**Class Name:** _[TriggerOrder](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/TriggerOrder.ts)_
|
|
173
|
-
**Severity:** 🔵 *Note*
|
|
174
|
-
|
|
175
|
-
### Process Builder
|
|
176
|
-
Salesforce is transitioning away from Workflow Rules and Process Builder in favor of Flow. Begin migrating your organization’s automation to Flow.
|
|
177
|
-
|
|
178
|
-
**Rule ID:** `process-builder-usage`
|
|
179
|
-
**Class Name:** _[ProcessBuilder](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/ProcessBuilder.ts)_
|
|
180
|
-
**Severity:** 🟡 *Warning*
|
|
181
|
-
|
|
182
|
-
### Record ID as String 
|
|
183
|
-
Detects flows using a String variable named `recordId` as input when they could receive the entire record object instead. Since recent Salesforce releases, record pages and quick actions can pass the complete record, eliminating the need for an additional Get Records query and improving performance.
|
|
184
|
-
|
|
185
|
-
**Rule ID:** `record-id-as-string`
|
|
186
|
-
**Class Name:** _[RecordIdAsString](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/RecordIdAsString.ts)_
|
|
187
|
-
**Severity:** 🔴 *Error*
|
|
188
|
-
|
|
189
|
-
### Recursive After Update
|
|
190
|
-
After-update flows are meant for modifying **other** records. Using them on the same record can cause recursion. Consider **before-save** flows for same-record updates.
|
|
191
|
-
|
|
192
|
-
**Rule ID:** `recursive-record-update`
|
|
193
|
-
**Class Name:** _[RecursiveAfterUpdate](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/RecursiveAfterUpdate.ts)_
|
|
194
|
-
**Severity:** 🟡 *Warning*
|
|
195
|
-
|
|
196
|
-
### Same Record Field Updates
|
|
197
|
-
Similar to triggers, **before-save** contexts can update the same record via `$Record` without invoking DML.
|
|
198
|
-
|
|
199
|
-
**Rule ID:** `same-record-field-updates`
|
|
200
|
-
**Class Name:** _[SameRecordFieldUpdates](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/SameRecordFieldUpdates.ts)_
|
|
201
|
-
**Severity:** 🟡 *Warning*
|
|
202
|
-
|
|
203
|
-
### SOQL Query In A Loop
|
|
204
|
-
To prevent exceeding Apex governor limits, consolidate all SOQL queries at the end of the flow.
|
|
205
|
-
|
|
206
|
-
**Rule ID:** `soql-in-loop`
|
|
207
|
-
**Class Name:** _[SOQLQueryInLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/SOQLQueryInLoop.ts)_
|
|
208
|
-
**Severity:** 🔴 *Error*
|
|
209
|
-
|
|
210
|
-
### Transform Instead of Loop 
|
|
211
|
-
Detects Loop elements that directly connect to Assignment elements. Transform elements handle collection manipulation in bulk operations, providing significant performance improvements over iterative loop-assignment patterns.
|
|
212
|
-
|
|
213
|
-
**Rule ID:** `transform-instead-of-loop`
|
|
214
|
-
**Class Name:** _[TransformInsteadOfLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/TransformInsteadOfLoop.ts)_
|
|
215
|
-
**Severity:** 🔵 *Note*
|
|
216
|
-
|
|
217
|
-
### Unclear API Name
|
|
218
|
-
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, remember to update the API name of the newly created copy.
|
|
219
|
-
|
|
220
|
-
**Rule ID:** `unclear-api-naming`
|
|
221
|
-
**Class Name:** _[CopyAPIName](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/CopyAPIName.ts)_
|
|
222
|
-
**Severity:** 🟡 *Warning*
|
|
223
|
-
|
|
224
|
-
### Unreachable Element
|
|
225
|
-
Avoid unconnected elements that are not used by the flow to keep flows efficient and maintainable.
|
|
226
|
-
|
|
227
|
-
**Rule ID:** `unreachable-element`
|
|
228
|
-
**Class Name:** _[UnconnectedElement](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/UnconnectedElement.ts)_
|
|
229
|
-
**Severity:** 🟡 *Warning*
|
|
230
|
-
|
|
231
|
-
### Unsafe Running Context
|
|
232
|
-
This flow is configured to run in System Mode without Sharing. This system context grants all running users the permission to view and edit all data in your org. Running a flow in System Mode without Sharing can lead to unsafe data access.
|
|
233
|
-
|
|
234
|
-
**Rule ID:** `unsafe-running-context`
|
|
235
|
-
**Class Name:** _[UnsafeRunningContext](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/UnsafeRunningContext.ts)_
|
|
236
|
-
**Severity:** 🔴 *Error*
|
|
237
|
-
|
|
238
|
-
### Unused Variable
|
|
239
|
-
To maintain efficiency and manageability, avoid including variables that are never referenced.
|
|
240
|
-
|
|
241
|
-
**Rule ID:** `unused-variable`
|
|
242
|
-
**Class Name:** _[UnusedVariable](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/UnusedVariable.ts)_
|
|
243
|
-
**Severity:** 🟡 *Warning*
|
|
56
|
+
<!-- START GENERATED_RULES -->
|
|
57
|
+
### Action Call In A Loop
|
|
58
|
+
To prevent exceeding Apex governor limits, it is advisable to consolidate and bulkify your apex calls, utilizing a single action call containing a collection variable at the end of the loop.
|
|
59
|
+
|
|
60
|
+
**Rule ID:** `action-call-in-loop`
|
|
61
|
+
**Class Name:** _[ActionCallsInLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/ActionCallsInLoop.ts)_
|
|
62
|
+
**Severity:** 🔴 *Error*
|
|
63
|
+
|
|
64
|
+
### DML Statement In A Loop
|
|
65
|
+
To prevent exceeding Apex governor limits, consolidate all your database operations—record creation, updates, or deletions—at the conclusion of the flow.
|
|
66
|
+
|
|
67
|
+
**Rule ID:** `dml-in-loop`
|
|
68
|
+
**Class Name:** _[DMLStatementInLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/DMLStatementInLoop.ts)_
|
|
69
|
+
**Severity:** 🔴 *Error*
|
|
70
|
+
|
|
71
|
+
### Duplicate DML Operation
|
|
72
|
+
When a flow executes database changes or actions between two screens, prevent users from navigating backward between screens; otherwise, duplicate database operations may be performed.
|
|
73
|
+
|
|
74
|
+
**Rule ID:** `duplicate-dml`
|
|
75
|
+
**Class Name:** _[DuplicateDMLOperation](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/DuplicateDMLOperation.ts)_
|
|
76
|
+
**Severity:** 🟡 *Warning*
|
|
77
|
+
|
|
78
|
+
### Excessive Cyclomatic Complexity
|
|
79
|
+
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.
|
|
80
|
+
|
|
81
|
+
**Rule ID:** `excessive-cyclomatic-complexity`
|
|
82
|
+
**Class Name:** _[CyclomaticComplexity](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/CyclomaticComplexity.ts)_
|
|
83
|
+
**Severity:** 🔵 *Note*
|
|
84
|
+
|
|
85
|
+
### Flow Naming Convention
|
|
86
|
+
The readability of a flow is paramount. Establishing a naming convention significantly enhances findability, searchability, and overall consistency. Include at least a domain and a brief description of the flow’s actions, for example `Service_OrderFulfillment`.
|
|
87
|
+
|
|
88
|
+
**Rule ID:** `invalid-naming-convention`
|
|
89
|
+
**Class Name:** _[FlowName](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/FlowName.ts)_
|
|
90
|
+
**Severity:** 🔴 *Error*
|
|
91
|
+
|
|
92
|
+
### Get Record All Fields
|
|
93
|
+
Following the principle of least privilege (PoLP), avoid using **Get Records** with “Automatically store all fields” unless necessary.
|
|
94
|
+
|
|
95
|
+
**Rule ID:** `get-record-all-fields`
|
|
96
|
+
**Class Name:** _[GetRecordAllFields](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/GetRecordAllFields.ts)_
|
|
97
|
+
**Severity:** 🟡 *Warning*
|
|
98
|
+
|
|
99
|
+
### Hardcoded Id
|
|
100
|
+
Avoid hard-coding IDs because they are org specific. Instead, pass them into variables at the start of the flow—via merge-field URL parameters or a **Get Records** element.
|
|
101
|
+
|
|
102
|
+
**Rule ID:** `hardcoded-id`
|
|
103
|
+
**Class Name:** _[HardcodedId](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/HardcodedId.ts)_
|
|
104
|
+
**Severity:** 🔴 *Error*
|
|
105
|
+
|
|
106
|
+
### Hardcoded Url
|
|
107
|
+
Avoid hard-coding URLs because they are environment specific. Use an `$API` formula (preferred) or environment-specific sources like custom labels, metadata, or settings.
|
|
108
|
+
|
|
109
|
+
**Rule ID:** `hardcoded-url`
|
|
110
|
+
**Class Name:** _[HardcodedUrl](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/HardcodedUrl.ts)_
|
|
111
|
+
**Severity:** 🔴 *Error*
|
|
112
|
+
|
|
113
|
+
### Inactive Flow
|
|
114
|
+
Like cleaning out your closet: deleting unused flows is essential. Inactive flows can still cause trouble—such as accidentally deleting records during testing, or being activated as subflows.
|
|
115
|
+
|
|
116
|
+
**Rule ID:** `inactive-flow`
|
|
117
|
+
**Class Name:** _[InactiveFlow](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/InactiveFlow.ts)_
|
|
118
|
+
**Severity:** 🟡 *Warning*
|
|
119
|
+
|
|
120
|
+
### Invalid API Version
|
|
121
|
+
Introducing newer API components may lead to unexpected issues with older versions of Flows, as they might not align with the underlying mechanics. Starting from API version 50.0, the **Api Version** attribute has been readily available on the Flow Object. To ensure smooth operation and reduce discrepancies between API versions, it is strongly advised to regularly update and maintain them.
|
|
122
|
+
|
|
123
|
+
**Rule ID:** `invalid-api-version`
|
|
124
|
+
**Class Name:** _[APIVersion](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/APIVersion.ts)_
|
|
125
|
+
**Severity:** 🟡 *Warning*
|
|
126
|
+
|
|
127
|
+
### Missing Auto Layout
|
|
128
|
+
With Canvas Mode set to Auto-Layout, elements are spaced, connected, and aligned automatically, keeping your Flow neatly organized—saving you time.
|
|
129
|
+
|
|
130
|
+
**Rule ID:** `missing-auto-layout`
|
|
131
|
+
**Class Name:** _[AutoLayout](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/AutoLayout.ts)_
|
|
132
|
+
**Severity:** 🔵 *Note*
|
|
133
|
+
|
|
134
|
+
### Missing Fault Path
|
|
135
|
+
A flow may fail to execute an operation as intended. By default, the flow displays an error to the user and emails the creator. Customize this behavior by incorporating a Fault Path.
|
|
136
|
+
|
|
137
|
+
**Rule ID:** `missing-fault-path`
|
|
138
|
+
**Class Name:** _[MissingFaultPath](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingFaultPath.ts)_
|
|
139
|
+
**Severity:** 🟡 *Warning*
|
|
140
|
+
|
|
141
|
+
### Missing Filter Record Trigger 
|
|
142
|
+
Record-triggered flows that lack filters on changed fields or entry conditions can lead to unnecessary executions on every record change. This may degrade system performance, hit governor limits faster, and increase resource consumption in high-volume orgs.
|
|
143
|
+
|
|
144
|
+
**Rule ID:** `missing-record-trigger-filter`
|
|
145
|
+
**Class Name:** _[MissingFilterRecordTrigger](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingFilterRecordTrigger.ts)_
|
|
146
|
+
**Severity:** 🟡 *Warning*
|
|
147
|
+
|
|
148
|
+
### Missing Flow Description
|
|
149
|
+
Descriptions play a vital role in documentation. It is highly recommended to include details about where a flow is used and its intended purpose.
|
|
150
|
+
|
|
151
|
+
**Rule ID:** `missing-flow-description`
|
|
152
|
+
**Class Name:** _[FlowDescription](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/FlowDescription.ts)_
|
|
153
|
+
**Severity:** 🔴 *Error*
|
|
154
|
+
|
|
155
|
+
### Missing Metadata Description 
|
|
156
|
+
Flags Flow elements (Get Records, Assignments, Decisions, Actions, etc.) and metadata components (Variables, Formulas, Constants, Text Templates) that lack a description. Adding concise descriptions greatly improves readability, maintainability, and helps AI tools understand your automation intent.
|
|
157
|
+
|
|
158
|
+
**Rule ID:** `missing-metadata-description`
|
|
159
|
+
**Class Name:** _[MissingMetadataDescription](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingMetadataDescription.ts)_
|
|
160
|
+
**Severity:** 🔴 *Error*
|
|
161
|
+
|
|
162
|
+
### Missing Null Handler
|
|
163
|
+
When a **Get Records** operation finds no data, it returns `null`. Validate data by using a Decision element to check for a non-null result.
|
|
164
|
+
|
|
165
|
+
**Rule ID:** `missing-null-handler`
|
|
166
|
+
**Class Name:** _[MissingNullHandler](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingNullHandler.ts)_
|
|
167
|
+
**Severity:** 🟡 *Warning*
|
|
168
|
+
|
|
169
|
+
### Missing Trigger Order
|
|
170
|
+
Guarantee your flow execution order with the **Trigger Order** property introduced in Spring '22.value to their flows and guarantee their execution order. This priority value is not an absolute value, so the values need not be sequentially numbered as 1, 2, 3, and so on.
|
|
171
|
+
|
|
172
|
+
**Rule ID:** `unspecified-trigger-order`
|
|
173
|
+
**Class Name:** _[TriggerOrder](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/TriggerOrder.ts)_
|
|
174
|
+
**Severity:** 🔵 *Note*
|
|
175
|
+
|
|
176
|
+
### Process Builder
|
|
177
|
+
Salesforce is transitioning away from Workflow Rules and Process Builder in favor of Flow. Begin migrating your organization’s automation to Flow.
|
|
178
|
+
|
|
179
|
+
**Rule ID:** `process-builder-usage`
|
|
180
|
+
**Class Name:** _[ProcessBuilder](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/ProcessBuilder.ts)_
|
|
181
|
+
**Severity:** 🟡 *Warning*
|
|
182
|
+
|
|
183
|
+
### Record ID as String 
|
|
184
|
+
Detects flows using a String variable named `recordId` as input when they could receive the entire record object instead. Since recent Salesforce releases, record pages and quick actions can pass the complete record, eliminating the need for an additional Get Records query and improving performance.
|
|
185
|
+
|
|
186
|
+
**Rule ID:** `record-id-as-string`
|
|
187
|
+
**Class Name:** _[RecordIdAsString](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/RecordIdAsString.ts)_
|
|
188
|
+
**Severity:** 🔴 *Error*
|
|
189
|
+
|
|
190
|
+
### Recursive After Update
|
|
191
|
+
After-update flows are meant for modifying **other** records. Using them on the same record can cause recursion. Consider **before-save** flows for same-record updates.
|
|
192
|
+
|
|
193
|
+
**Rule ID:** `recursive-record-update`
|
|
194
|
+
**Class Name:** _[RecursiveAfterUpdate](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/RecursiveAfterUpdate.ts)_
|
|
195
|
+
**Severity:** 🟡 *Warning*
|
|
196
|
+
|
|
197
|
+
### Same Record Field Updates
|
|
198
|
+
Similar to triggers, **before-save** contexts can update the same record via `$Record` without invoking DML.
|
|
199
|
+
|
|
200
|
+
**Rule ID:** `same-record-field-updates`
|
|
201
|
+
**Class Name:** _[SameRecordFieldUpdates](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/SameRecordFieldUpdates.ts)_
|
|
202
|
+
**Severity:** 🟡 *Warning*
|
|
203
|
+
|
|
204
|
+
### SOQL Query In A Loop
|
|
205
|
+
To prevent exceeding Apex governor limits, consolidate all SOQL queries at the end of the flow.
|
|
206
|
+
|
|
207
|
+
**Rule ID:** `soql-in-loop`
|
|
208
|
+
**Class Name:** _[SOQLQueryInLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/SOQLQueryInLoop.ts)_
|
|
209
|
+
**Severity:** 🔴 *Error*
|
|
210
|
+
|
|
211
|
+
### Transform Instead of Loop 
|
|
212
|
+
Detects Loop elements that directly connect to Assignment elements. Transform elements handle collection manipulation in bulk operations, providing significant performance improvements over iterative loop-assignment patterns.
|
|
213
|
+
|
|
214
|
+
**Rule ID:** `transform-instead-of-loop`
|
|
215
|
+
**Class Name:** _[TransformInsteadOfLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/TransformInsteadOfLoop.ts)_
|
|
216
|
+
**Severity:** 🔵 *Note*
|
|
217
|
+
|
|
218
|
+
### Unclear API Name
|
|
219
|
+
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, remember to update the API name of the newly created copy.
|
|
220
|
+
|
|
221
|
+
**Rule ID:** `unclear-api-naming`
|
|
222
|
+
**Class Name:** _[CopyAPIName](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/CopyAPIName.ts)_
|
|
223
|
+
**Severity:** 🟡 *Warning*
|
|
224
|
+
|
|
225
|
+
### Unreachable Element
|
|
226
|
+
Avoid unconnected elements that are not used by the flow to keep flows efficient and maintainable.
|
|
227
|
+
|
|
228
|
+
**Rule ID:** `unreachable-element`
|
|
229
|
+
**Class Name:** _[UnconnectedElement](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/UnconnectedElement.ts)_
|
|
230
|
+
**Severity:** 🟡 *Warning*
|
|
231
|
+
|
|
232
|
+
### Unsafe Running Context
|
|
233
|
+
This flow is configured to run in System Mode without Sharing. This system context grants all running users the permission to view and edit all data in your org. Running a flow in System Mode without Sharing can lead to unsafe data access.
|
|
234
|
+
|
|
235
|
+
**Rule ID:** `unsafe-running-context`
|
|
236
|
+
**Class Name:** _[UnsafeRunningContext](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/UnsafeRunningContext.ts)_
|
|
237
|
+
**Severity:** 🔴 *Error*
|
|
238
|
+
|
|
239
|
+
### Unused Variable
|
|
240
|
+
To maintain efficiency and manageability, avoid including variables that are never referenced.
|
|
241
|
+
|
|
242
|
+
**Rule ID:** `unused-variable`
|
|
243
|
+
**Class Name:** _[UnusedVariable](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/UnusedVariable.ts)_
|
|
244
|
+
**Severity:** 🟡 *Warning*
|
|
244
245
|
<!-- END GENERATED_RULES -->
|
|
245
246
|
|
|
246
247
|
---
|
|
@@ -252,6 +253,7 @@ It is recommend to configure and define:
|
|
|
252
253
|
- The severity of violating any specific rule.
|
|
253
254
|
- Expressions used for rules, such as REGEX patterns and comparison operators.
|
|
254
255
|
- Any known exceptions that should be ignored during scanning.
|
|
256
|
+
- Flows or directories to exclude from scanning entirely.
|
|
255
257
|
|
|
256
258
|
```json
|
|
257
259
|
{
|
|
@@ -346,6 +348,48 @@ _Example_
|
|
|
346
348
|
}
|
|
347
349
|
```
|
|
348
350
|
|
|
351
|
+
### Exclude Flows from Scanning
|
|
352
|
+
|
|
353
|
+
Lightning Flow Scanner provides two complementary ways to exclude flows from scanning:
|
|
354
|
+
|
|
355
|
+
#### Exclude by File Path (Node.js only)
|
|
356
|
+
|
|
357
|
+
Use glob patterns to exclude flows based on their file system location. This is useful for excluding entire directories or specific file patterns during the flow discovery phase:
|
|
358
|
+
|
|
359
|
+
```json
|
|
360
|
+
{
|
|
361
|
+
"ignore": [
|
|
362
|
+
"**/testing/**",
|
|
363
|
+
"**/*_Deprecated.flow-meta.xml"
|
|
364
|
+
]
|
|
365
|
+
}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
**Note**: The `ignore` option uses glob patterns and applies during file discovery before flows are parsed. This is the most efficient way to exclude large numbers of flows.
|
|
369
|
+
|
|
370
|
+
**Environment compatibility**: `ignore` requires Node.js (file system access) and is available in CLI Plugin, VS Code Extension, and GitHub Action. It is **not** available when using the Core Library in browser/web environments.
|
|
371
|
+
|
|
372
|
+
#### Exclude by Flow API Name (Browser-compatible)
|
|
373
|
+
|
|
374
|
+
Exclude specific flows by their unique API names, regardless of their location. This is particularly useful for:
|
|
375
|
+
- Excluding specific flows without knowing their exact file path
|
|
376
|
+
- Working with metadata API deployments where directory structures may vary
|
|
377
|
+
- More precise control than path-based patterns
|
|
378
|
+
|
|
379
|
+
```json
|
|
380
|
+
{
|
|
381
|
+
"ignoreFlows": [
|
|
382
|
+
"My_Legacy_Flow",
|
|
383
|
+
"Temporary_Test_Flow",
|
|
384
|
+
"Deprecated_Process_Builder"
|
|
385
|
+
]
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
**Note**: The `ignoreFlows` option applies after flows are parsed, using the flow's API name (the `<fullName>` element in the flow metadata). Flow names are unique identifiers and work regardless of the flow's file system location.
|
|
390
|
+
|
|
391
|
+
**Environment compatibility**: `ignoreFlows` works in **all environments** including Node.js and browser/web distributions, as it operates on parsed flow data rather than file system paths.
|
|
392
|
+
|
|
349
393
|
### Scan Modes
|
|
350
394
|
|
|
351
395
|
#### Beta Mode
|
package/main/libs/ScanFlows.js
CHANGED
|
@@ -37,8 +37,13 @@ function getSuppressionsForRule(rule, flowName, exceptions) {
|
|
|
37
37
|
}
|
|
38
38
|
function scan(parsedFlows, ruleOptions) {
|
|
39
39
|
const flows = [];
|
|
40
|
+
const ignoreFlows = (ruleOptions === null || ruleOptions === void 0 ? void 0 : ruleOptions.ignoreFlows) || [];
|
|
40
41
|
for (const flow of parsedFlows){
|
|
41
42
|
if (!flow.errorMessage && flow.flow) {
|
|
43
|
+
// Filter out flows whose names are in the ignore list
|
|
44
|
+
if (ignoreFlows.length > 0 && ignoreFlows.includes(flow.flow.name)) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
42
47
|
flows.push(flow.flow);
|
|
43
48
|
}
|
|
44
49
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flow-scanner/lightning-flow-scanner-core",
|
|
3
3
|
"description": "A lightweight engine for Flow metadata in Node.js, and browser environments. Assess and enhance Salesforce Flow automations for best practices, security, governor limits, and performance issues.",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.14.0",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|