Skip to content

Commit 66641a3

Browse files
committed
chore(cli): improve category documentation
1 parent 8f1fa1b commit 66641a3

2 files changed

Lines changed: 38 additions & 57 deletions

File tree

packages/cli/README.md

Lines changed: 37 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737

3838
- **[Usage](#usage)**
3939
- **[Default Rules](#default-rules)**
40+
- [Problems](#problems)
41+
- [Suggestions](#suggestions)
42+
- [Layout](#layout)
4043
- **[Configuration](#configuration)**
4144
- **[Installation](#installation)**
4245
- **[Development](#development)**
@@ -84,201 +87,179 @@ sf flow:fix -d src/force-app # Fix flows in a specific directory
8487
> Want to help improve this project? See our [Contributing Guidelines](https://github.com/Flow-Scanner/lightning-flow-scanner?tab=contributing-ov-file)
8588
8689
<!-- START GENERATED_RULES -->
90+
8791
### Problems
8892

89-
### DML Statement In A Loop
90-
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.
93+
Rules that detect issues highly likely to cause runtime errors, security risks, governor limit exceptions, or deployment failures.
9194

95+
#### DML Statement In A Loop
96+
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.
9297
**Rule ID:** `dml-in-loop`
9398
**Class Name:** _[DMLStatementInLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/DMLStatementInLoop.ts)_
9499
**Severity:** 🔴 *Error*
95100

96-
### Hardcoded Id
101+
#### Hardcoded Id
97102
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.
98-
99103
**Rule ID:** `hardcoded-id`
100104
**Class Name:** _[HardcodedId](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/HardcodedId.ts)_
101105
**Severity:** 🔴 *Error*
102106

103-
### Hardcoded Url
107+
#### Hardcoded Url
104108
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.
105-
106109
**Rule ID:** `hardcoded-url`
107110
**Class Name:** _[HardcodedUrl](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/HardcodedUrl.ts)_
108111
**Severity:** 🔴 *Error*
109112

110-
### Process Builder
113+
#### Process Builder
111114
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.
112-
113115
**Rule ID:** `process-builder-usage`
114116
**Class Name:** _[ProcessBuilder](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/ProcessBuilder.ts)_
115117
**Severity:** 🔴 *Error*
116118

117-
### SOQL Query In A Loop
119+
#### SOQL Query In A Loop
118120
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.
119-
120121
**Rule ID:** `soql-in-loop`
121122
**Class Name:** _[SOQLQueryInLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/SOQLQueryInLoop.ts)_
122123
**Severity:** 🔴 *Error*
123124

124-
### Unsafe Running Context
125+
#### Unsafe Running Context
125126
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.
126-
127127
**Rule ID:** `unsafe-running-context`
128128
**Class Name:** _[UnsafeRunningContext](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/UnsafeRunningContext.ts)_
129129
**Severity:** 🔴 *Error*
130130

131-
### Duplicate DML Operation
131+
#### Duplicate DML Operation
132132
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.
133-
134133
**Rule ID:** `duplicate-dml`
135134
**Class Name:** _[DuplicateDMLOperation](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/DuplicateDMLOperation.ts)_
136135
**Severity:** 🟡 *Warning*
137136

138-
### Missing Fault Path
137+
#### Missing Fault Path
139138
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.
140-
141139
**Rule ID:** `missing-fault-path`
142140
**Class Name:** _[MissingFaultPath](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingFaultPath.ts)_
143141
**Severity:** 🟡 *Warning*
144142

145-
### Missing Null Handler
143+
#### Missing Null Handler
146144
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.
147-
148145
**Rule ID:** `missing-null-handler`
149146
**Class Name:** _[MissingNullHandler](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingNullHandler.ts)_
150147
**Severity:** 🟡 *Warning*
151148

152-
### Recursive After Update
149+
#### Recursive After Update
153150
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.
154-
155151
**Rule ID:** `recursive-record-update`
156152
**Class Name:** _[RecursiveAfterUpdate](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/RecursiveAfterUpdate.ts)_
157153
**Severity:** 🟡 *Warning*
158154

159155

160-
161156
### Suggestions
162157

163-
### Action Call In A Loop
164-
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.
158+
Rules in this category recommend better patterns and optimizations related to performance, bulkification, trigger behavior, and overall design. Following them improves efficiency and long-term maintainability without affecting correctness.
165159

160+
#### Action Call In A Loop
161+
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.
166162
**Rule ID:** `action-call-in-loop`
167163
**Class Name:** _[ActionCallsInLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/ActionCallsInLoop.ts)_
168164
**Severity:** 🟡 *Warning*
169165

170-
### Get Record All Fields
166+
#### Get Record All Fields
171167
Avoid using Get Records to retrieve all fields unless necessary. This improves performance, reduces processing time, and limits exposure of unnecessary data.
172-
173168
**Rule ID:** `get-record-all-fields`
174169
**Class Name:** _[GetRecordAllFields](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/GetRecordAllFields.ts)_
175170
**Severity:** 🟡 *Warning*
176171

177-
### Inactive Flow
172+
#### Inactive Flow
178173
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.
179-
180174
**Rule ID:** `inactive-flow`
181175
**Class Name:** _[InactiveFlow](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/InactiveFlow.ts)_
182176
**Severity:** 🟡 *Warning*
183177

184-
### Invalid API Version
178+
#### Invalid API Version
185179
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.
186-
187180
**Rule ID:** `invalid-api-version`
188181
**Class Name:** _[APIVersion](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/APIVersion.ts)_
189182
**Severity:** 🟡 *Warning*
190183

191-
### Missing Filter Record Trigger ![Beta](https://img.shields.io/badge/status-beta-yellow)
184+
#### Missing Filter Record Trigger ![Beta](https://img.shields.io/badge/status-beta-yellow)
192185
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.
193-
194186
**Rule ID:** `missing-record-trigger-filter`
195187
**Class Name:** _[MissingFilterRecordTrigger](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingFilterRecordTrigger.ts)_
196188
**Severity:** 🟡 *Warning*
197189

198-
### Same Record Field Updates
190+
#### Same Record Field Updates
199191
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
200-
201192
**Rule ID:** `same-record-field-updates`
202193
**Class Name:** _[SameRecordFieldUpdates](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/SameRecordFieldUpdates.ts)_
203194
**Severity:** 🟡 *Warning*
204195

205-
### Excessive Cyclomatic Complexity
196+
#### Excessive Cyclomatic Complexity
206197
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.
207-
208198
**Rule ID:** `excessive-cyclomatic-complexity`
209199
**Class Name:** _[CyclomaticComplexity](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/CyclomaticComplexity.ts)_
210200
**Severity:** 🔵 *Note*
211201

212-
### Missing Trigger Order
202+
#### Missing Trigger Order
213203
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.
214-
215204
**Rule ID:** `unspecified-trigger-order`
216205
**Class Name:** _[TriggerOrder](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/TriggerOrder.ts)_
217206
**Severity:** 🔵 *Note*
218207

219-
### Record ID as String ![Beta](https://img.shields.io/badge/status-beta-yellow)
208+
#### Record ID as String ![Beta](https://img.shields.io/badge/status-beta-yellow)
220209
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.
221-
222210
**Rule ID:** `record-id-as-string`
223211
**Class Name:** _[RecordIdAsString](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/RecordIdAsString.ts)_
224212
**Severity:** 🔵 *Note*
225213

226-
### Transform Instead of Loop ![Beta](https://img.shields.io/badge/status-beta-yellow)
214+
#### Transform Instead of Loop ![Beta](https://img.shields.io/badge/status-beta-yellow)
227215
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.
228-
229216
**Rule ID:** `transform-instead-of-loop`
230217
**Class Name:** _[TransformInsteadOfLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/TransformInsteadOfLoop.ts)_
231218
**Severity:** 🔵 *Note*
232219

233220

234-
235221
### Layout
236222

237-
### Flow Naming Convention
238-
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.
223+
Rules in this category enforce consistency in naming, documentation, element organization, and visual layout. They help ensure Flows remain readable, well-documented, and structured as automations scale.
239224

225+
#### Flow Naming Convention
226+
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.
240227
**Rule ID:** `invalid-naming-convention`
241228
**Class Name:** _[FlowName](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/FlowName.ts)_
242229
**Severity:** 🔴 *Error*
243230

244-
### Missing Flow Description
231+
#### Missing Flow Description
245232
Flow descriptions are essential for documentation and maintainability. Include a description for each Flow, explaining its purpose and where it's used.
246-
247233
**Rule ID:** `missing-flow-description`
248234
**Class Name:** _[FlowDescription](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/FlowDescription.ts)_
249235
**Severity:** 🔴 *Error*
250236

251-
### Missing Metadata Description ![Beta](https://img.shields.io/badge/status-beta-yellow)
237+
#### Missing Metadata Description ![Beta](https://img.shields.io/badge/status-beta-yellow)
252238
Elements and metadata without a description reduce clarity and maintainability. Adding descriptions improves readability and makes your automation easier to understand.
253-
254239
**Rule ID:** `missing-metadata-description`
255240
**Class Name:** _[MissingMetadataDescription](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingMetadataDescription.ts)_
256241
**Severity:** 🟡 *Warning*
257242

258-
### Unclear API Name
243+
#### Unclear API Name
259244
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.
260-
261245
**Rule ID:** `unclear-api-naming`
262246
**Class Name:** _[CopyAPIName](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/CopyAPIName.ts)_
263247
**Severity:** 🟡 *Warning*
264248

265-
### Unreachable Element
249+
#### Unreachable Element
266250
Unconnected elements never execute and add unnecessary clutter. Remove or connect unused Flow elements to keep Flows clean and efficient.
267-
268251
**Rule ID:** `unreachable-element`
269252
**Class Name:** _[UnconnectedElement](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/UnconnectedElement.ts)_
270253
**Severity:** 🟡 *Warning*
271254

272-
### Unused Variable
255+
#### Unused Variable
273256
Unused variables are never referenced and add unnecessary clutter. Remove them to keep Flows efficient and easy to maintain.
274-
275257
**Rule ID:** `unused-variable`
276258
**Class Name:** _[UnusedVariable](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/UnusedVariable.ts)_
277259
**Severity:** 🟡 *Warning*
278260

279-
### Missing Auto Layout
261+
#### Missing Auto Layout
280262
Auto-Layout automatically arranges and aligns Flow elements, keeping the canvas organized and easier to maintain. Enabling it saves time and improves readability.
281-
282263
**Rule ID:** `missing-auto-layout`
283264
**Class Name:** _[AutoLayout](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/AutoLayout.ts)_
284265
**Severity:** 🔵 *Note*

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lightning-flow-scanner",
3-
"version": "6.16.0",
3+
"version": "6.16.1",
44
"bugs": "https://github.com/Flow-Scanner/lightning-flow-scanner/issues",
55
"description": "A Salesforce CLI plugin for analysis and optimization of Salesforce Flow. Scans metadata for 20+ issues such as hardcoded IDs, unsafe contexts, inefficient SOQL/DML operations, recursion risks, and missing fault handling. Supports auto-fixes, rule configurations, and CI/CD integration to help users maintain secure and reliable Flow automations.",
66
"dependencies": {

0 commit comments

Comments
 (0)