Rule Documentation CPRIMA USG 001 - rpapub/WatchfulAnvil GitHub Wiki
CPRIMA-USG-001 - ShouldStop Activity Presence Check
Rule ID: CPRIMA-USG-001
Scope: Project
Description
The ShouldStop activity is a crucial component in UiPath workflows for gracefully terminating processes based on external stop requests. This rule ensures that at least one ShouldStop activity exists in the project to improve workflow robustness and adherence to best practices.
The rule scans all workflows within the project, recursively checking each activity for the presence of a ShouldStop activity. If none are found, an error is triggered in the Error List panel.
Recommendation
Make sure your project includes at least one ShouldStop activity in relevant workflows, especially in long-running or unattended processes that may require controlled termination.
Why is this important?
✅ Ensures automation can respond to external stop requests. ✅ Prevents unnecessary processing when a stop command is received. ✅ Improves system reliability and resource management.
How to Fix It
- Locate a point in your workflow where the process should check for termination.
- Add a "ShouldStop" activity in an appropriate place (e.g., inside loops, at key checkpoints).
- Use "If" or "Flow Decision" activities to handle scenarios where a stop request is received.
Example Fix
1. Add a "ShouldStop" activity.
2. Use a conditional check:
- If `ShouldStop = True`, terminate or exit the workflow.
- Else, continue execution.
Modifying the Rule
This rule is enabled by default and cannot be customized within UiPath Studio. However, developers may choose to disable it in the Workflow Analyzer settings if needed.
Steps to Disable in UiPath Studio
- Open Project Settings.
- Go to the Workflow Analyzer tab.
- Locate CPRIMA-USG-001 - ShouldStop Activity Presence Check.
- Uncheck the rule to disable it.
Use Cases for ShouldStop Activity
Scenario | Why ShouldStop is Needed? |
---|---|
Long-running unattended processes | Prevents unnecessary execution when a termination request is issued. |
Loops processing large datasets | Allows graceful exit from an ongoing loop when a stop request is received. |
Error-handling workflows | Helps manage unexpected system failures by stopping execution when required. |
Reset to Default Values
By default, CPRIMA-USG-001 enforces a mandatory check for at least one ShouldStop activity in the project.
To restore default settings, right-click the rule in the Project Settings window and select Reset to default.
Rule Behavior Summary
Rule Behavior | Result |
---|---|
ShouldStop activity found in any workflow | ✅ No error, project passes validation. |
No ShouldStop activity found in any workflow | ❌ Error is triggered in the Error List panel. |
By following this rule, you ensure graceful termination of processes, making your UiPath automation more robust and manageable. 🚀