Flow equivalent of Static Code Analysis-esque rules
Code Analysis rules run against Apex in Gearset. As Salesforce development continues to rely on Flows as the main tool for declarative automation, it's becoming challenging to catch known inefficiencies, known issues, and discouraged usages. It would really set Gearset a part as a deployment tool to utilize issue detection or run "rules" against Flow metadata to call out potential issues or flows not following best practices to even prevent a deployment or commit from occurring.
Examples: SOQL or DML in a loop, the number of elements for flows (prior to api v57) or general overall complexity, lack of Descriptions on elements, using an Object filter in the start element of a scheduled-triggered flow then not writing the flow to run efficiently per $Record.
Also attempting to deploy a flow with reference items that do not exist on the target - objects, fields, email alerts, email templates (Summer '23), etc. This happens on the Salesforce validation size, but only shows 1 error at a time like other validation errors, and would be really beneficial in the problem analysis step to catch missing dependencies ahead of time.
I attempted to roughly tackle the first one with a script I could run locally in VSC/SFDX to analyze the current state of an org. However, being able to utilize this within a comparison and deployment as part of the Problem Analysis would be game changing, especially for larger teams where advanced admins often work independently and there's less opportunities for peer programming or peer review.
https://github.com/MonicaBrie13/SalesforceFlowAnalysis
-
[Deleted User] commented
some other ideas:
* Cyclomatic complexity - too many elements (needs sub flows)
* Cyclomatic complexity - too many nested Decision elements
* Naming conventions (e.g. API names that start with Copy n )
* DRY - duplicated conditions
* Missing Fault paths