Code analysis rules
- Updated: 2023/12/06
Code analysis rules
Rules are the foundation of code analysis. They are used to evaluate the automation (Task Bot and API Task) logic. Rules can be simple or complex depending on the evaluation performed. Rules include coding practices that can be verified. They apply to packages and actions in the automation code.
A rule consists of a unique RULE_CODE and a description which indicates the nature of the evaluation to be done on the code. You can use the severity levels (low or high) to emphasize the criticality of the rule.
The following table lists the rules and their description that can be used with code
analysis:
Rule code | Group | Title | Rule description | Applicable to automation file |
---|---|---|---|---|
ACT-GEN-001 | Actions, general | Action Maximum | The number of actions in the bot cannot exceed the specified maximum | Task Bot, API Task |
ACT-GEN-002 | Actions, general | Try-Catch Coverage | All the non-comment actions within the bot logic must be within a Try/Catch block. | Task Bot, API Task |
ACT-GEN-003 | Actions, general | Infinite Loop Detection | Mandates the check for infinite loops in the bot logic | Task Bot, API Task |
VAR-NMG-001 | Variables, naming | Variable Name Pattern | Variable names must match the specified naming pattern | Task Bot, API Task |
VAR-NMG-002 | Variables, naming | Variable Name Length | Variable names must be within the specified minimum and maximum character length | Task Bot, API Task |
VAR-USG-001 | Variables, usage | No Unused Variables | All the variables must be used within the bot | Task Bot, API Task |
ACT-COM-001 | Actions, comments | Mandatory Header Comment | The first action in the bot must be a Comment action | Task Bot, API Task |
ACT-COM-002 | Actions, comments | Comment Coverage | The number of Comment actions must be equal to or greater than the specified percentage of total command actions | Task Bot, API Task |
VAL-HCV-002 | Values, hard coded values | No Hard Coded Delay | The delay time in the Delay action must be set using a variable | Task Bot, API Task |
VAL-HCV-003 | Values, hard coded values | No Hard Coded File Path | The file or folder path must be set using a variable | Task Bot |
VAL-HCV-004 | Values, hard coded values | No Hard Coded Email Address | The command action field must not contain a hard-coded email address | Task Bot, API Task |
ACT-ERR-001 | Actions, error handling | No Empty Catch | The catch block cannot be empty | Task Bot, API Task |
ACT-ERR-002 | Actions, error handling | Mandatory Catch Logging | The catch block must contain a Log to File action | Task Bot, API Task |
ACT-ERR-003 | Actions, error handling | Mandatory Catch Screen Capture | The catch block must contain a Screen capture action | Task Bot |
ACT-ERR-004 | Actions, error handling | Mandatory Catch Line Reference | The catch block error must contain the reference line number | Task Bot, API Task |
ACT-LOG-001 | Actions, logs | Log to file coverage | The bot logic must contain the specified ratio of Log to file actions | Task Bot |