|
1 | | -# lightning-flow-scanner README |
| 1 | + [](https://github.com/Lightning-Flow-Scanner/lightning-flow-scanner-vsce) |
2 | 2 |
|
3 | | -This is the README for your extension "lightning-flow-scanner". After writing up a brief description, we recommend including the following sections. |
| 3 | +__*Analyze Salesforce Flows for optimization and ensure adherence to Industry Best Practices.*__ |
4 | 4 |
|
5 | | -## Features |
| 5 | + [](https://github.com/Lightning-Flow-Scanner/lightning-flow-scanner-vsce) |
6 | 6 |
|
7 | | -Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. |
| 7 | +**Also available as [Salesforce CLI Plugin](https://github.com/Lightning-Flow-Scanner/lightning-flow-scanner-sfdx)* |
8 | 8 |
|
9 | | -For example if there is an image subfolder under your extension project workspace: |
| 9 | +## Using the commands |
10 | 10 |
|
11 | | -\!\[feature X\]\(images/feature-x.png\) |
| 11 | +Open the **Command Palette** and type `Flow` to see the list of all available commands. |
12 | 12 |
|
13 | | -> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow. |
| 13 | +### Scan Flows |
14 | 14 |
|
15 | | -## Requirements |
| 15 | +Use the `Scan Flows` command by choosing either a directory or a selection of flows to run the analysis on. |
16 | 16 |
|
17 | | -If you have any requirements or dependencies, add a section describing those and how to install and configure them. |
| 17 | +### Configure Scanner |
18 | 18 |
|
19 | | -## Extension Settings |
| 19 | +Use the `Configurate Flow Rules` command to configure the rules executed during scanning. |
20 | 20 |
|
21 | | -Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. |
| 21 | +### Fix Flows |
22 | 22 |
|
23 | | -For example: |
| 23 | +Use the `Fix Flows` command to apply available fixes automatically. |
24 | 24 |
|
25 | | -This extension contributes the following settings: |
| 25 | +### View Default Flow Rules |
26 | 26 |
|
27 | | -* `myExtension.enable`: Enable/disable this extension. |
28 | | -* `myExtension.thing`: Set to `blah` to do something. |
| 27 | +The `Default Flow Rules` command can be used to view more details on the rules that are applied to Flows in the scans. |
29 | 28 |
|
30 | | -## Known Issues |
| 29 | +### Calculate Flow Test Coverage |
31 | 30 |
|
32 | | -Calling out known issues can help limit users opening duplicate issues against your extension. |
| 31 | +The `Calculate Flow Coverage` command calculates Flow Test coverage percentages by running the apex tests in your default connectedOrg. |
33 | 32 |
|
34 | | -## Release Notes |
35 | 33 |
|
36 | | -Users appreciate release notes as you update your extension. |
| 34 | +## Rule Overview |
37 | 35 |
|
38 | | -### 1.0.0 |
| 36 | +| Rule | Description | |
| 37 | +|--------------|:-----------| |
| 38 | +| **Outdated API Version** | 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. | |
| 39 | +| **Copy API Name** | Maintaining multiple elements with a similar name, like 'Copy_X_Of_Element,' can diminish the overall readability of your Flow. When copying and pasting these elements, it's crucial to remember to update the API name of the newly created copy. | |
| 40 | +| **DML Statement In A Loop** | To prevent exceeding Apex governor limits, it is advisable to consolidate all your database operations, including record creation, updates, or deletions, at the conclusion of the flow. | |
| 41 | +| **Duplicate DML Operation** | When the flow executes database changes or actions between two screens, it's important to prevent users from navigating back between screens. Failure to do so may result in duplicate database operations being performed within the flow. | |
| 42 | +| **Hardcoded Id** | Avoid hard-coding IDs as they are org-specific. Instead, pass them into variables at the start of the flow. You can achieve this by utilizing merge fields in URL parameters or employing a Get Records element. | |
| 43 | +| **Flow Naming Convention** | The readability of a flow is of utmost importance. Establishing a naming convention for the Flow Name significantly enhances findability, searchability, and maintains overall consistency. It is advisable to include at least a domain and a brief description of the actions carried out in the flow, for instance, 'Service_OrderFulfillment'. | |
| 44 | +| **Missing Flow Description** | Descriptions play a vital role in documentation. We highly recommend including details about where they are used and their intended purpose. | |
| 45 | +| **Missing Fault Path** | At times, a flow may fail to execute a configured operation as intended. By default, the flow displays an error message to the user and notifies the admin who created the flow via email. However, you can customize this behavior by incorporating a Fault Path. | |
| 46 | +| **Missing Null Handler** | When a Get Records operation doesn't find any data, it returns null. To ensure data validation, utilize a decision element on the operation result variable to check for a non-null result. | |
| 47 | +| **SOQL Query In A Loop** | To prevent exceeding Apex governor limits, it is advisable to consolidate all your SOQL queries at the conclusion of the flow. | |
| 48 | +| **Unconnected Element** | Unconnected elements which are not being used by the Flow should be avoided to keep Flows efficient and maintainable. | |
| 49 | +| **Unused Variable** | To maintain the efficiency and manageability of your Flow, it's advisable to avoid including unconnected variables that are not in use. | |
39 | 50 |
|
40 | | -Initial release of ... |
| 51 | +**More information on the rules can be found in the [lfs-core module documentation](https://github.com/Lightning-Flow-Scanner/lightning-flow-scanner-core).* |
41 | 52 |
|
42 | | -### 1.0.1 |
43 | | - |
44 | | -Fixed issue #. |
45 | | - |
46 | | -### 1.1.0 |
47 | | - |
48 | | -Added features X, Y, and Z. |
49 | | - |
50 | | ---- |
51 | | - |
52 | | -## Following extension guidelines |
53 | | - |
54 | | -Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension. |
55 | | - |
56 | | -* [Extension Guidelines](https://code.visualstudio.com/api/references/extension-guidelines) |
57 | | - |
58 | | -## Working with Markdown |
59 | | - |
60 | | -You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: |
61 | | - |
62 | | -* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux). |
63 | | -* Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux). |
64 | | -* Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets. |
65 | | - |
66 | | -## For more information |
67 | | - |
68 | | -* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) |
69 | | -* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) |
70 | | - |
71 | | -**Enjoy!** |
| 53 | +## Settings |
| 54 | + Name | Description | Type | Default value | |
| 55 | +|--------------|:-----------|--------------|:-----------| |
| 56 | +| SpecifyFlows | Specify flow file paths instead of a root directory. | boolean | false | |
| 57 | +| NamingConvention | Specify a REGEX expression to use as Flow Naming convention. | string | [A-Za-z0-9]+_[A-Za-z0-9]+ | |
| 58 | +| APIVersion | Specify an expression to validate the API version, i.e. '===50'(use at least 50). | string | >50 | |
0 commit comments