@flow-scanner/lightning-flow-scanner-core 6.16.0 → 6.16.2
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 +47 -43
- package/main/models/FlowType.js +4 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
## Table of contents
|
|
33
33
|
|
|
34
34
|
- **[Default Rules](#default-rules)**
|
|
35
|
-
- [
|
|
36
|
-
- [
|
|
37
|
-
- [
|
|
35
|
+
- [Problems](#problems)
|
|
36
|
+
- [Suggestions](#suggestions)
|
|
37
|
+
- [Layout](#layout)
|
|
38
38
|
- **[Configuration](#configuration)**
|
|
39
39
|
- [Configure Rules](#configure-rules)
|
|
40
40
|
- [Define Exceptions](#define-exceptions)
|
|
@@ -53,202 +53,211 @@
|
|
|
53
53
|
<p>📌<strong>Tip:</strong> To link directly to a specific rule, use the full GitHub anchor link format. Example:</p>
|
|
54
54
|
<p><em><a href="https://flow-scanner.github.io/lightning-flow-scanner/#unsafe-running-context">https://flow-scanner.github.io/lightning-flow-scanner/#unsafe-running-context</a></em></p>
|
|
55
55
|
|
|
56
|
-
> Want to
|
|
56
|
+
> Want to help improve this project? See our [Contributing Guidelines](https://github.com/Flow-Scanner/lightning-flow-scanner?tab=contributing-ov-file)
|
|
57
57
|
|
|
58
58
|
<!-- START GENERATED_RULES -->
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
59
62
|
### Problems
|
|
60
63
|
|
|
61
|
-
|
|
64
|
+
These rules detect anti-patterns and unsafe practices in your Flows that could break functionality, compromise security, or cause deployment failures.
|
|
65
|
+
|
|
66
|
+
#### DML Statement In A Loop
|
|
62
67
|
Executing DML operations (insert, update, delete) inside a loop is a high-risk anti-pattern that frequently causes governor limit exceptions. All database operations should be collected and executed once, outside the loop.
|
|
63
68
|
|
|
64
69
|
**Rule ID:** `dml-in-loop`
|
|
65
70
|
**Class Name:** _[DMLStatementInLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/DMLStatementInLoop.ts)_
|
|
66
71
|
**Severity:** 🔴 *Error*
|
|
67
72
|
|
|
68
|
-
|
|
73
|
+
#### Hardcoded Id
|
|
69
74
|
Avoid hard-coding record IDs, as they are unique to a specific org and will not work in other environments. Instead, store IDs in variables—such as merge-field URL parameters or a **Get Records** element—to make the Flow portable, maintainable, and flexible.
|
|
70
75
|
|
|
71
76
|
**Rule ID:** `hardcoded-id`
|
|
72
77
|
**Class Name:** _[HardcodedId](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/HardcodedId.ts)_
|
|
73
78
|
**Severity:** 🔴 *Error*
|
|
74
79
|
|
|
75
|
-
|
|
80
|
+
#### Hardcoded Url
|
|
76
81
|
Avoid hard-coding URLs, as they may change between environments or over time. Instead, store URLs in variables or custom settings to make the Flow adaptable, maintainable, and environment-independent.
|
|
77
82
|
|
|
78
83
|
**Rule ID:** `hardcoded-url`
|
|
79
84
|
**Class Name:** _[HardcodedUrl](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/HardcodedUrl.ts)_
|
|
80
85
|
**Severity:** 🔴 *Error*
|
|
81
86
|
|
|
82
|
-
|
|
87
|
+
#### Process Builder
|
|
83
88
|
Process Builder is retired. Continuing to use it increases maintenance overhead and risks future compatibility issues. Migrating automation to Flow reduces risk and improves maintainability.
|
|
84
89
|
|
|
85
90
|
**Rule ID:** `process-builder-usage`
|
|
86
91
|
**Class Name:** _[ProcessBuilder](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/ProcessBuilder.ts)_
|
|
87
92
|
**Severity:** 🔴 *Error*
|
|
88
93
|
|
|
89
|
-
|
|
94
|
+
#### SOQL Query In A Loop
|
|
90
95
|
Running SOQL queries inside a loop can rapidly exceed query limits and severely degrade performance. Queries should be executed once, with results reused throughout the loop.
|
|
91
96
|
|
|
92
97
|
**Rule ID:** `soql-in-loop`
|
|
93
98
|
**Class Name:** _[SOQLQueryInLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/SOQLQueryInLoop.ts)_
|
|
94
99
|
**Severity:** 🔴 *Error*
|
|
95
100
|
|
|
96
|
-
|
|
101
|
+
#### Unsafe Running Context
|
|
97
102
|
Flows configured to run in System Mode without Sharing grant access to all data, bypassing user permissions. Avoid this setting to prevent security risks and protect sensitive data.
|
|
98
103
|
|
|
99
104
|
**Rule ID:** `unsafe-running-context`
|
|
100
105
|
**Class Name:** _[UnsafeRunningContext](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/UnsafeRunningContext.ts)_
|
|
101
106
|
**Severity:** 🔴 *Error*
|
|
102
107
|
|
|
103
|
-
|
|
108
|
+
#### Duplicate DML Operation
|
|
104
109
|
When a Flow performs database operations across multiple screens, users navigating backward can cause the same actions to run multiple times. To prevent unintended changes, either restrict backward navigation or redesign the Flow so database operations execute in a single, forward-moving step.
|
|
105
110
|
|
|
106
111
|
**Rule ID:** `duplicate-dml`
|
|
107
112
|
**Class Name:** _[DuplicateDMLOperation](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/DuplicateDMLOperation.ts)_
|
|
108
113
|
**Severity:** 🟡 *Warning*
|
|
109
114
|
|
|
110
|
-
|
|
115
|
+
#### Missing Fault Path
|
|
111
116
|
Elements that can fail should include a Fault Path to handle errors gracefully. Without it, failures show generic errors to users. Fault Paths improve reliability and user experience.
|
|
112
117
|
|
|
113
118
|
**Rule ID:** `missing-fault-path`
|
|
114
119
|
**Class Name:** _[MissingFaultPath](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingFaultPath.ts)_
|
|
115
120
|
**Severity:** 🟡 *Warning*
|
|
116
121
|
|
|
117
|
-
|
|
122
|
+
#### Missing Null Handler
|
|
118
123
|
Get Records operations return null when no data is found. Without handling these null values, Flows can fail or produce unintended results. Adding a null check improves reliability and ensures the Flow behaves as expected.
|
|
119
124
|
|
|
120
125
|
**Rule ID:** `missing-null-handler`
|
|
121
126
|
**Class Name:** _[MissingNullHandler](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingNullHandler.ts)_
|
|
122
127
|
**Severity:** 🟡 *Warning*
|
|
123
128
|
|
|
124
|
-
|
|
129
|
+
#### Recursive After Update
|
|
125
130
|
After-save Flows that update the same record can trigger recursion, causing unintended behavior or performance issues. Avoid updating the triggering record in after-save Flows; use before-save Flows instead to prevent recursion.
|
|
126
131
|
|
|
127
132
|
**Rule ID:** `recursive-record-update`
|
|
128
133
|
**Class Name:** _[RecursiveAfterUpdate](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/RecursiveAfterUpdate.ts)_
|
|
129
134
|
**Severity:** 🟡 *Warning*
|
|
130
135
|
|
|
131
|
-
|
|
136
|
+
---
|
|
132
137
|
|
|
133
138
|
### Suggestions
|
|
134
139
|
|
|
135
|
-
|
|
140
|
+
These rules highlight areas where Flows can be improved. Following them increases reliability and long-term maintainability.
|
|
141
|
+
|
|
142
|
+
#### Action Call In A Loop
|
|
136
143
|
Repeatedly invoking Apex actions inside a loop can exhaust governor limits and lead to performance issues. Where possible, bulkify your logic by moving the action call outside the loop and passing a collection variable instead.
|
|
137
144
|
|
|
138
145
|
**Rule ID:** `action-call-in-loop`
|
|
139
146
|
**Class Name:** _[ActionCallsInLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/ActionCallsInLoop.ts)_
|
|
140
147
|
**Severity:** 🟡 *Warning*
|
|
141
148
|
|
|
142
|
-
|
|
149
|
+
#### Get Record All Fields
|
|
143
150
|
Avoid using Get Records to retrieve all fields unless necessary. This improves performance, reduces processing time, and limits exposure of unnecessary data.
|
|
144
151
|
|
|
145
152
|
**Rule ID:** `get-record-all-fields`
|
|
146
153
|
**Class Name:** _[GetRecordAllFields](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/GetRecordAllFields.ts)_
|
|
147
154
|
**Severity:** 🟡 *Warning*
|
|
148
155
|
|
|
149
|
-
|
|
156
|
+
#### Inactive Flow
|
|
150
157
|
Inactive Flows should be deleted or archived to reduce risk. Even when inactive, they can cause unintended record changes during testing or be activated as subflows. Keeping only active, relevant Flows improves safety and maintainability.
|
|
151
158
|
|
|
152
159
|
**Rule ID:** `inactive-flow`
|
|
153
160
|
**Class Name:** _[InactiveFlow](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/InactiveFlow.ts)_
|
|
154
161
|
**Severity:** 🟡 *Warning*
|
|
155
162
|
|
|
156
|
-
|
|
163
|
+
#### Invalid API Version
|
|
157
164
|
Flows running on outdated API versions may behave inconsistently when newer platform features or components are used. From API version 50.0 onward, the API Version attribute explicitly controls Flow runtime behavior. Keeping Flows aligned with a supported API version helps prevent compatibility issues and ensures predictable execution.
|
|
158
165
|
|
|
159
166
|
**Rule ID:** `invalid-api-version`
|
|
160
167
|
**Class Name:** _[APIVersion](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/APIVersion.ts)_
|
|
161
168
|
**Severity:** 🟡 *Warning*
|
|
162
169
|
|
|
163
|
-
|
|
170
|
+
#### Missing Filter Record Trigger 
|
|
164
171
|
Record-triggered Flows without filters on changed fields or entry conditions execute on every record change. Adding filters ensures the Flow runs only when needed, improving performance.
|
|
165
172
|
|
|
166
173
|
**Rule ID:** `missing-record-trigger-filter`
|
|
167
174
|
**Class Name:** _[MissingFilterRecordTrigger](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingFilterRecordTrigger.ts)_
|
|
168
175
|
**Severity:** 🟡 *Warning*
|
|
169
176
|
|
|
170
|
-
|
|
177
|
+
#### Same Record Field Updates
|
|
171
178
|
Before-save Flows can safely update the triggering record directly via $Record, applying changes efficiently without extra DML operations. Using before-save updates improves performance
|
|
172
179
|
|
|
173
180
|
**Rule ID:** `same-record-field-updates`
|
|
174
181
|
**Class Name:** _[SameRecordFieldUpdates](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/SameRecordFieldUpdates.ts)_
|
|
175
182
|
**Severity:** 🟡 *Warning*
|
|
176
183
|
|
|
177
|
-
|
|
184
|
+
#### Excessive Cyclomatic Complexity
|
|
178
185
|
High numbers of loops and decision elements increase a Flow's cyclomatic complexity. To maintain simplicity and readability, consider using subflows or splitting a Flow into smaller, ordered Flows.
|
|
179
186
|
|
|
180
187
|
**Rule ID:** `excessive-cyclomatic-complexity`
|
|
181
188
|
**Class Name:** _[CyclomaticComplexity](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/CyclomaticComplexity.ts)_
|
|
182
189
|
**Severity:** 🔵 *Note*
|
|
183
190
|
|
|
184
|
-
|
|
191
|
+
#### Missing Trigger Order
|
|
185
192
|
Record-triggered Flows without a specified Trigger Order may execute in an unpredictable sequence. Setting a Trigger Order ensures your Flows run in the intended order.
|
|
186
193
|
|
|
187
194
|
**Rule ID:** `unspecified-trigger-order`
|
|
188
195
|
**Class Name:** _[TriggerOrder](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/TriggerOrder.ts)_
|
|
189
196
|
**Severity:** 🔵 *Note*
|
|
190
197
|
|
|
191
|
-
|
|
198
|
+
#### Record ID as String 
|
|
192
199
|
Flows that use a String variable for a record ID instead of receiving the full record introduce unnecessary complexity and additional Get Records queries. Using the complete record simplifies the Flow and improves performance.
|
|
193
200
|
|
|
194
201
|
**Rule ID:** `record-id-as-string`
|
|
195
202
|
**Class Name:** _[RecordIdAsString](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/RecordIdAsString.ts)_
|
|
196
203
|
**Severity:** 🔵 *Note*
|
|
197
204
|
|
|
198
|
-
|
|
205
|
+
#### Transform Instead of Loop 
|
|
199
206
|
Loop elements that perform direct Assignments on each item can slow down Flows. Using Transform elements allows bulk operations on collections, improving performance and reducing complexity.
|
|
200
207
|
|
|
201
208
|
**Rule ID:** `transform-instead-of-loop`
|
|
202
209
|
**Class Name:** _[TransformInsteadOfLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/TransformInsteadOfLoop.ts)_
|
|
203
210
|
**Severity:** 🔵 *Note*
|
|
204
211
|
|
|
205
|
-
|
|
212
|
+
---
|
|
206
213
|
|
|
207
214
|
### Layout
|
|
208
215
|
|
|
209
|
-
|
|
216
|
+
Focused on naming, documentation, and organization, these rules ensure Flows remain clear, easy to understand, and maintainable as automations grow.
|
|
217
|
+
|
|
218
|
+
#### Flow Naming Convention
|
|
210
219
|
Using clear and consistent Flow names improves readability, discoverability, and maintainability. A good naming convention helps team members quickly understand a Flow's purpose—for example, including a domain and brief description like Service_OrderFulfillment. Adopt a naming pattern that aligns with your organization's standards.
|
|
211
220
|
|
|
212
221
|
**Rule ID:** `invalid-naming-convention`
|
|
213
222
|
**Class Name:** _[FlowName](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/FlowName.ts)_
|
|
214
223
|
**Severity:** 🔴 *Error*
|
|
215
224
|
|
|
216
|
-
|
|
225
|
+
#### Missing Flow Description
|
|
217
226
|
Flow descriptions are essential for documentation and maintainability. Include a description for each Flow, explaining its purpose and where it's used.
|
|
218
227
|
|
|
219
228
|
**Rule ID:** `missing-flow-description`
|
|
220
229
|
**Class Name:** _[FlowDescription](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/FlowDescription.ts)_
|
|
221
230
|
**Severity:** 🔴 *Error*
|
|
222
231
|
|
|
223
|
-
|
|
232
|
+
#### Missing Metadata Description 
|
|
224
233
|
Elements and metadata without a description reduce clarity and maintainability. Adding descriptions improves readability and makes your automation easier to understand.
|
|
225
234
|
|
|
226
235
|
**Rule ID:** `missing-metadata-description`
|
|
227
236
|
**Class Name:** _[MissingMetadataDescription](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingMetadataDescription.ts)_
|
|
228
237
|
**Severity:** 🟡 *Warning*
|
|
229
238
|
|
|
230
|
-
|
|
239
|
+
#### Unclear API Name
|
|
231
240
|
Elements with unclear or duplicated API names, like Copy_X_Of_Element, reduce Flow readability. Make sure to update the API name when copying elements to keep your Flow organized.
|
|
232
241
|
|
|
233
242
|
**Rule ID:** `unclear-api-naming`
|
|
234
243
|
**Class Name:** _[CopyAPIName](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/CopyAPIName.ts)_
|
|
235
244
|
**Severity:** 🟡 *Warning*
|
|
236
245
|
|
|
237
|
-
|
|
246
|
+
#### Unreachable Element
|
|
238
247
|
Unconnected elements never execute and add unnecessary clutter. Remove or connect unused Flow elements to keep Flows clean and efficient.
|
|
239
248
|
|
|
240
249
|
**Rule ID:** `unreachable-element`
|
|
241
250
|
**Class Name:** _[UnconnectedElement](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/UnconnectedElement.ts)_
|
|
242
251
|
**Severity:** 🟡 *Warning*
|
|
243
252
|
|
|
244
|
-
|
|
253
|
+
#### Unused Variable
|
|
245
254
|
Unused variables are never referenced and add unnecessary clutter. Remove them to keep Flows efficient and easy to maintain.
|
|
246
255
|
|
|
247
256
|
**Rule ID:** `unused-variable`
|
|
248
257
|
**Class Name:** _[UnusedVariable](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/UnusedVariable.ts)_
|
|
249
258
|
**Severity:** 🟡 *Warning*
|
|
250
259
|
|
|
251
|
-
|
|
260
|
+
#### Missing Auto Layout
|
|
252
261
|
Auto-Layout automatically arranges and aligns Flow elements, keeping the canvas organized and easier to maintain. Enabling it saves time and improves readability.
|
|
253
262
|
|
|
254
263
|
**Rule ID:** `missing-auto-layout`
|
|
@@ -407,7 +416,7 @@ Use glob patterns to exclude flows based on their file system location. This is
|
|
|
407
416
|
}
|
|
408
417
|
```
|
|
409
418
|
|
|
410
|
-
**Environment compatibility**:
|
|
419
|
+
**Environment compatibility**: requires Node.js(file system access) and is not available when using the Core Library in browser/web environments.
|
|
411
420
|
|
|
412
421
|
#### Exclude by Flow API Name (Browser-compatible)
|
|
413
422
|
|
|
@@ -426,7 +435,7 @@ Exclude specific flows by their unique API names, regardless of their location.
|
|
|
426
435
|
}
|
|
427
436
|
```
|
|
428
437
|
|
|
429
|
-
**Environment compatibility**:
|
|
438
|
+
**Environment compatibility**: works in **all environments** including Node.js and browser/web distributions, as it operates on parsed flow data rather than file system paths.
|
|
430
439
|
|
|
431
440
|
### Scan Modes
|
|
432
441
|
|
|
@@ -435,18 +444,14 @@ Exclude specific flows by their unique API names, regardless of their location.
|
|
|
435
444
|
New rules are introduced in Beta mode before being added to the default ruleset. To include current Beta rules, enable the optional betamode parameter in your configuration:
|
|
436
445
|
|
|
437
446
|
```json
|
|
438
|
-
{
|
|
439
|
-
"betaMode": true
|
|
440
|
-
}
|
|
447
|
+
{ "betaMode": true }
|
|
441
448
|
```
|
|
442
449
|
|
|
443
450
|
#### Rule Mode
|
|
444
451
|
|
|
445
|
-
By default, Lightning Flow Scanner runs **all** default rules and merges any custom configurations you provide.
|
|
452
|
+
By default, Lightning Flow Scanner runs **all** default rules and merges any custom configurations you provide. If instead, you want to run **only** the rules you explicitly specify, use:
|
|
446
453
|
```json
|
|
447
|
-
{
|
|
448
|
-
"ruleMode": "isolated"
|
|
449
|
-
}
|
|
454
|
+
{ "ruleMode": "isolated" }
|
|
450
455
|
```
|
|
451
456
|
|
|
452
457
|
## Installation
|
|
@@ -628,4 +633,3 @@ For more on Programmatic API, types, and advanced usage of `@flow-scanner/lightn
|
|
|
628
633
|
```
|
|
629
634
|
This creates UMD at `dist/lightning-flow-scanner-core.umd.js`.
|
|
630
635
|
|
|
631
|
-
**Want to help improve Lightning Flow Scanner? See our [Contributing Guidelines](https://github.com/Flow-Scanner/lightning-flow-scanner?tab=contributing-ov-file)**
|
package/main/models/FlowType.js
CHANGED
|
@@ -52,10 +52,12 @@ _define_property(FlowType, "surveyTypes", [
|
|
|
52
52
|
"Survey"
|
|
53
53
|
]);
|
|
54
54
|
_define_property(FlowType, "unsupportedTypes", [
|
|
55
|
+
"ActionPlan",
|
|
56
|
+
"UserProvisioningFlow",
|
|
55
57
|
"CheckoutFlow",
|
|
56
58
|
"FSCLending",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
+
"LoyaltyManagementFlow",
|
|
60
|
+
"JourneyBuilderIntegration"
|
|
59
61
|
]);
|
|
60
62
|
_define_property(FlowType, "visualTypes", [
|
|
61
63
|
"Flow",
|
|
@@ -65,7 +67,6 @@ _define_property(FlowType, "visualTypes", [
|
|
|
65
67
|
"Appointments",
|
|
66
68
|
"ActionCadenceStepFlow",
|
|
67
69
|
"ContactRequestFlow",
|
|
68
|
-
"ContactRequestFlow",
|
|
69
70
|
"CustomerLifecycle",
|
|
70
71
|
"FieldServiceMobile",
|
|
71
72
|
"FieldServiceWeb",
|
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.16.
|
|
4
|
+
"version": "6.16.2",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|