Skip to content

Commit 86f178d

Browse files
authored
Merge pull request #3384 from MicrosoftDocs/NikosMoutzourakis-static-analysis
Nikos moutzourakis static analysis
2 parents 42db89c + c7b9efa commit 86f178d

File tree

6 files changed

+200
-0
lines changed

6 files changed

+200
-0
lines changed

articles/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,8 @@
572572
href: ./desktop-flows/manage-ui-elements-collections.md
573573
- name: Use and update UI elements collections
574574
href: ./desktop-flows/use-update-ui-elements-collections.md
575+
- name: Flow checker (preview)
576+
href: ./desktop-flows/static-analysis.md
575577
- name: Troubleshooter
576578
href: ./desktop-flows/troubleshooter.md
577579
- name: How to
87.1 KB
Loading
20.7 KB
Loading
29.7 KB
Loading
36.8 KB
Loading
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
---
2+
title: Flow Checker (preview)
3+
description: Learn how to use the static analysis feature to scan your code for errors, security issues, and coding standard violations—helping you improve code quality.
4+
author: NikosMoutzourakis
5+
ms.service: power-automate
6+
ms.subservice: desktop-flow
7+
ms.topic: how-to
8+
ms.date: 05/08/2025
9+
ms.author: nimoutzo
10+
ms.reviewer: danamartens
11+
contributors:
12+
- NikosMoutzourakis
13+
search.audienceType:
14+
- flowmaker
15+
- enduser
16+
---
17+
18+
# Flow checker (preview)
19+
20+
[!INCLUDE [preview-banner](~/../shared-content/shared/preview-includes/preview-banner.md)]
21+
22+
Improve your development workflow with the static analysis feature in [solution checker](/power-apps/maker/data-platform/use-powerapps-checker). This tool supports best practices in robotic process automation (RPA) and meets critical flow requirements by automatically evaluating your flows to ensure optimal performance. Static analysis is available in the **Flow checker** section of the designer. It enforces key guidelines and provides real-time feedback and early code inspection. It integrates directly into your workflow, improves code quality, and lays the foundation for a more efficient and productive development experience.
23+
24+
[!INCLUDE [preview-note](~/../shared-content/shared/preview-includes/preview-note-pp.md)]
25+
26+
## Rule management
27+
28+
Rules are defined and managed through solution checker in the Power Platform admin center. Admins can:
29+
30+
- Enable or disable rules.
31+
- Configure severity levels (error, warning, info).
32+
- Apply rules to specific environments or environment groups ([Managed Environments](/power-platform/admin/managed-environment-overview) only).
33+
34+
### Configuration in the admin center
35+
36+
To configure static analysis rules:
37+
38+
1. Go to the Power Platform admin center.
39+
1. Select **Manage** > **Environments** to proceed.
40+
1. Select **Edit managed environments**.
41+
1. In the **Solution checker enforcement** section, configure which rules should be excluded for the selected environment.
42+
43+
> [!NOTE]
44+
> If the environment is part of an environment group with a defined configuration, the rule settings are inherited and can't be edited individually.
45+
46+
Learn more about solution checker in [Solution checker](/power-apps/maker/data-platform/use-powerapps-checker) and [Solution checker enforcement in Managed Environments](/power-platform/admin/managed-environment-solution-checker).
47+
48+
## Run static analysis in the portal
49+
50+
To manually trigger static analysis:
51+
52+
1. Go to the **Solutions** page in the [Power Automate portal](https://make.powerautomate.com/).
53+
1. Open the context menu (⋯) next to a solution.
54+
1. Hover over **Solution checker**.
55+
1. Choose one of the following options:
56+
57+
- **Run**: Initiates the static analysis.
58+
- **View results**: Opens the latest analysis report.
59+
- **Download results**: Exports the report for offline review.
60+
61+
> [!NOTE]
62+
> Static analysis runs for all desktop flows included in a solution. Identify which desktop flow triggers a specific rule violation by checking the **Object name** column in the results. This column shows the name of the corresponding desktop flow.
63+
64+
:::image type="content" source="media\static-analysis\static-analysis-solution-chekcer-results.png" alt-text="Screenshot of the results of static analysis for a solution in the Power Automate portal.":::
65+
66+
## Static analysis in the designer
67+
68+
Static analysis runs automatically, continuously inspecting your code without requiring manual intervention. When you add, remove, or modify actions in your flow, this feature activates to assess the changes and refresh the analysis. This process makes development seamless and efficient.
69+
70+
:::image type="content" source="media\static-analysis\static-analysis-pad-button.png" alt-text="Screenshot of the button in Power Automate for Desktop designer that opens the static analysis pane.":::
71+
72+
Each analysis generates a percentage score that shows the proportion of rules successfully followed. A higher score means fewer violations and better code quality.
73+
74+
This score is recalculated every time a change is made to the flow, providing immediate feedback and promoting good development practices.
75+
76+
:::image type="content" source="media\static-analysis\static-analysis-pad-score.png" alt-text="Screenshot showing the static analysis score and a summary of any violated rules.":::
77+
78+
If rules are violated, the static analysis report shows a clear summary. It lists rule names and the number of actions or variables in your flow that violate each rule. Selecting a rule highlights the corresponding action and provides a detailed error explanation. For variable-related violations, the system navigates to the variable pane, making corrections easy.
79+
80+
Each violation displays a tile with details, including the error's nature, recommended fixes, and a link to documentation. Use the slider in the rule’s header to navigate between occurrences of the same violation. This guidance helps developers address issues quickly and effectively.
81+
82+
:::image type="content" source="media\static-analysis\static-analysis-pad-details.png" alt-text="Screenshot showing the details of a static analysis rule.":::
83+
84+
## Static analysis rules
85+
86+
Static analysis rules are predefined guidelines that help ensure your flows are secure, maintainable, and performant. Each rule targets specific aspects of flow design, such as security, performance, and maintainability, and provides actionable feedback to improve your flow's quality. Below is a list of the rules, their descriptions, and suggested fixes.
87+
88+
<a name="unsafepasswordsecurity"></a>
89+
### Unsafe password security
90+
91+
- **Default severity**: Warning
92+
- **Type**: Security rules - Security
93+
- **Error details**: Passwords are managed insecurely in the flow.
94+
- **Description**: This rule checks if passwords are managed insecurely in a desktop flow to ensure they're not exposed or mishandled during execution.
95+
- **Suggested fix**: Ensure all password-related inputs are handled appropriately by using the password features of Power Automate for desktop. Use "Direct encrypted text input" for maximum security through machine-based encryption. For flows used on different machines, choose "Password input as variable" and mark the corresponding variable as sensitive to enhance security. Also, use secure credential management features like the "Get Credential" action, which integrates with CyberArk credentials.
96+
97+
<a name="recursionsubflows"></a>
98+
### Recursion between two subflows
99+
100+
- **Default severity**: Warning
101+
- **Type**: Best practices rules - Performance
102+
- **Error details**: Recursive calls detected between subflows, potentially causing an infinite loop.
103+
- **Description**: This rule checks for recursive calls between two or more subflows, ensuring that the flow doesn't enter an infinite loop.
104+
- **Suggested fix**: Remove any recursive calls between the subflows.
105+
106+
<a name="variablelength"></a>
107+
### Variable length exceeded
108+
109+
- **Default severity**: Warning
110+
- **Type**: Variable rules - Maintainability
111+
- **Error details**: Variable name exceeds the 25-character limit.
112+
- **Description**: This rule verifies if the name of each variable defined in the flow exceeds a specified number of characters. The default limit is 25 characters.
113+
- **Suggested fix**: Rename any variables that exceed the specified character limit to ensure their names are shorter than 25 characters.
114+
115+
<a name="variabledefaultvalues"></a>
116+
### Input variable default values
117+
118+
- **Default severity**: Warning
119+
- **Type**: Variable rules - Maintainability
120+
- **Error details**: Input/output variables aren't using default values.
121+
- **Description**: This rule verifies if Input/Output variables are using default values, ensuring that they're properly configured for the flow.
122+
- **Suggested fix**: Assign default values to all input and output variables in the flow.
123+
124+
<a name="thresholdvariablesnumber"></a>
125+
### Threshold on number of input and output variables
126+
127+
- **Default severity**: Warning
128+
- **Type**: Best practices rules - Maintainability
129+
- **Error details**: Total input/output variables exceed the 25-variable limit.
130+
- **Description**: This rule verifies if the total number of input/output variables in the flow exceeds a specified threshold. The default limit is 25 variables.
131+
- **Suggested fix**: Ensure that the number of input and output variables in the flow doesn't exceed 25.
132+
133+
<a name="emptyonblockerror"></a>
134+
### Empty on block error action
135+
136+
- **Default severity**: Warning
137+
- **Type**: Best practices rules - Maintainability
138+
- **Error details**: "On block error" action is empty and not handling errors.
139+
- **Description**: This rule checks whether the "On block error" actions in your flow are set up correctly to handle errors, making sure that errors are thrown and managed as expected.
140+
- **Suggested fix**: To manage potential errors, set up the **On block error** actions in the flow.
141+
142+
<a name="nestedifclauses"></a>
143+
### Nested if clauses
144+
145+
- **Default severity**: Warning
146+
- **Type**: Ease of maintenance rules - Maintainability
147+
- **Error details**: Nested If clauses exceed five levels.
148+
- **Description**: This rule checks if there are nested if statements with more than five levels, ensuring that the flow remains manageable and readable.
149+
- **Suggested fix**: Refactor the flow to reduce nested if statements to no more than five levels.
150+
151+
<a name="incompleteif"></a>
152+
### Incomplete if
153+
154+
- **Default severity**: Warning
155+
- **Type**: Ease of maintenance rules - Maintainability
156+
- **Error details**: Incomplete If action detected, lacking content or only containing actions in the Else branch.
157+
- **Description**: This rule detects If actions that lack content or only contain actions in the Else branch, ensuring that conditional statements are effectively implemented.
158+
- **Suggested fix**: Go through the flow and review each "If" condition to ensure that it includes meaningful actions in both the "If", "Else if", and "Else" branches.
159+
160+
<a name="infiniteloop"></a>
161+
### Infinite loop
162+
163+
- **Default severity**: Warning
164+
- **Type**: Reliability rules - Performance
165+
- **Error details**: Infinite loop detected in the flow, potentially causing it to run indefinitely.
166+
- **Description**: This rule checks if there are any infinite loops in the flow, helping to identify and prevent scenarios where the flow might run indefinitely.
167+
- **Suggested fix**: Make sure each loop has a clearly defined and achievable termination condition. The condition can be based on a counter, a specific value, or the completion of a task. Add checks or failsafe conditions to break the loop if it runs longer than expected. For example, set a maximum iteration count or include a timeout.
168+
169+
<a name="misusuwaitaction"></a>
170+
### Misuse of wait actions
171+
172+
- **Default severity**: Warning
173+
- **Type**: Performance rules - Performance
174+
- **Error details**: Misuse of wait actions detected, with more than 10 wait actions causing potential bottlenecks.
175+
- **Description**: This rule checks if the flow contains an excessive number of wait actions—by default, more than 10—to help identify and minimize potential bottlenecks caused by prolonged delays.
176+
- **Suggested fix**: Review the flow to identify all wait actions and check if they're essential for the flow's logic. Remove unnecessary waits or combine them where possible.
177+
178+
<a name="immensewaitactions"></a>
179+
### Immense wait time
180+
181+
- **Default severity**: Warning
182+
- **Type**: Performance rules - Performance
183+
- **Error details**: Immense wait time detected, exceeding the 600-second limit for hardcoded wait actions.
184+
- **Description**: This rule checks if the hardcoded wait actions in the flow exceed a specified amount of time, with the default limit set to 600 seconds.
185+
- **Suggested fix**: Review the flow to find wait actions that exceed the 600-second limit. Check if these long wait times are necessary and adjust their duration to the shortest time needed for the flow to work correctly. If a long wait is required, break it into shorter intervals and add checks or conditions between them. Whenever possible, replace long wait actions with event-driven triggers.
186+
187+
## Known limitations
188+
189+
- Available only in [Managed Environments](/power-platform/admin/managed-environment-overview).
190+
- Rule customization is limited to enabling or disabling rules and configuring severity.
191+
192+
## Known issues
193+
194+
- Deleting copied actions after viewing a rule violation detail can trigger unhandled errors.
195+
- Using a nonsensitive password variable in the following actions causes static analysis to fail during rule evaluation.
196+
- Display input dialog
197+
- Display select folder dialog
198+
- Display custom form

0 commit comments

Comments
 (0)