Analysis Rules
Built-in Rules
Сode analyzer has a built-in list of rules, shown in the table below.
| Code | Rule | Scope | Action | Note |
|---|---|---|---|---|
| MO-EX-001 | Empty Excel Application element | Element | Warning | It is recommended to remove empty “Excel Application” containers |
| MO-OU-001 | Empty Outlook Application element | Element | Warning | It is recommended to remove empty “Outlook Application” containers |
| PR-AN-001 | Continue on Error = true | Element | Warning | The rule shows elements with the “Continue on Error” property set to checked (true). It is recommended to use this property with caution, as all exceptions in this element will be ignored |
| ST-AN-001 | Project workflow counter | Project | Information | Shows the number of process files (*.ltw) in the project |
| ST-AN-002 | Process element counter | Process | Information | Shows the number of elements in one process |
| ST-PR-001 | Large number of arguments | Process | Error | The process exceeds the allowed number of arguments. The rule has an “Argument Counter” parameter, which is set to 20 by default |
| ST-PR-002 | Empty Catch block | Element | Error | The element has an empty Catch block, so the exception from the Try block is not handled |
| ST-PR-003 | Multiple diagram levels | Process | Error | Checks the nesting of diagrams according to the permitted value. The rule has a “Levels” parameter, which is set to 2 by default |
| ST-PR-004 | Empty workflow | Process | Warning | There is an empty process in the project. It is recommended to remove it |
| ST-PR-005 | Unreachable elements | Process | Warning | There are inaccessible elements in the process. For example, commented-out elements or elements unreachable by the diagram. It is recommended to remove them or add annotations for the commented-out elements |
| ST-PR-006 | Nested If Clauses | Process | Warning | The maximum nesting threshold for the If-Else element has been exceeded. It is recommended to minimize the nesting of If blocks to make the process easier to maintain. This rule has a “Limit” parameter; the default value is 3 |
| ST-PR-007 | Deeply Nested Activities | Process | Warning | The process contains nested containers, and the rule applies to all containers. It’s recommended to reduce the nesting to make the process easier to understand and maintain. The rule has a “Limit” parameter; the default value is 7 |
| ST-PR-008 | Incomplete If | Element | Warning | The If-Else element is empty. If your Else block is filled in but the Then block is empty, consider changing the logic of the If-Else element |
| ST-PR-009 | Variables Naming Convention | Process | Warning | The rule checks whether variable names comply with the naming convention. The rule has a “Regular expression” parameter for specifying a pattern |
| ST-PR-010 | Arguments Naming Convention | Process | Warning | The rule checks whether argument names comply with the naming convention. The rule has “Regular expression” parameters for arguments of all directions (In, Out, InOut) |
| ST-PR-011 | Variable Length Exceeded | Process | Warning | The variable name is too long. It is recommended to shorten the name. The rule has a “Length” parameter with a default value of 30 characters |
| ST-PR-012 | Argument Length Exceeded | Process | Warning | The argument name length is exceeded. It is recommended to shorten the name. The rule has a “Length” parameter with a default value of 30 characters |
| ST-PR-013 | Prefix Datatable Variables | Process | Warning | A variable of DataTable type must have a dt_ prefix |
| ST-PR-014 | Prefix Datatable Arguments | Process | Warning | A DataTable type argument must begin with the argument type and be followed by the dt_ prefix |
| ST-PR-015 | Argument Default Values | Process | Warning | Use default values for arguments when testing individual processes |
| ST-PR-016 | Unused variables | Process | Warning | There are unused variables in the process; it is recommended to remove them. |
| ST-PRJ-001 | Package restrictions | Project | Error | The project contains packages prohibited in your organization. The rule has a “Forbidden packages” parameter, where you can list such packages separated by a comma |
| ST-PRJ-002 | Required packages | Project | Error | The project is missing packages required by your organization. The rule has a “Required packages” parameter, where you can list such packages separated by a comma |
Additional Rules
If you want to expand the built-in list of rules, install the Primo.ProjectAnalyzer.Extended NuGet package.
You can install the package in the following ways:
- Download
Primo.ProjectAnalyzer.Extended.zipto the Studio installation folder. Unpack it to the root folder so that thePrimo.ProjectAnalyzer.Extended.dlllibrary is at the same level asPrimo.Studio.exe. Then restart Studio if it was running. - Install the Primo.ProjectAnalyzer.Extended NuGet package through the Dependency Management of Studio.
ℹ️
You can contact your sales manager for information on how to get Primo.ProjectAnalyzer.Extended.zip archive.
When installing the package, the analyzer will add the ability to save changes to the process/project when running the analysis, as well as new rules from the table below.
| Code | Rule | Scope | Action | Note |
|---|---|---|---|---|
| ST-PR-017 | Default component name | Element | Warning | The process uses a standard element name. It is better to give the element a unique name (rename it) indicating its purpose in the process. For example, the “Assign” element can be renamed to “Assign <variable name>”. A unique element name will help you quickly understand during debugging in which element an error occurred |
| ST-PR-018 | Infinite loop | Element | Warning | There is an endless loop in the process. For example, the rule will trigger if you have a “Do-While” loop with the condition true, as this may result in a situation where the robot cannot exit the loop |
| ST-PR-019 | Use of Generation 1 elements | Element | Warning | There are elements from the “Generation 1” group in the process. It is better to use new elements instead |
| ST-PR-020 | Checking nesting of “Open Browser”, “Attach browser”, “Attach application” | Element | Warning | The process has one or more of the specified containers with other containers nested in them |
| ST-PR-021 | Fixed delays in element | Element | Information | There is an element with delays specified in the general properties “Pause until (ms)”, “Pause after (ms)”. It is recommended to check if these pauses are really needed. Instead of pauses, you may want to use elements “Element exists”, “Element vanish”, etc. |
| ST-PR-022 | Exception variable in Try-Catch block not specified | Element | Warning | There is no variable specified in the Try-Catch element to store the exception. In this case, it will not be possible to handle it |
| ST-PR-023 | Nested loops | Process | Warning | There are nested loops in the process, which will make it difficult to understand and maintain. For Studio Pro, loops While, Do-While, ForEach, ForEach for DataTable, Repeat N times are checked. For Studio Citizen — Repeat N times, ForEach for DataTable. The rule has a “Threshold” parameter, where you can specify the allowed number of nesting for checking (default value 3) |
| ST-PR-024 | Annotation for main sequence not specified | Process | Warning | There is no comment for developers in the process for the root sequence |
| ST-PR-025 | Project workload | Process | Warning | The number of elements in one process exceeds the recommended number. The rule has parameters “Normal” (default value 20), “Medium” (default 50), “Critical” (default 100). You can change the values of these parameters |
| ST-PR-026 | Process overload with logs | Process | Warning | There are too many “Write to Log” elements used in the process. The rule has a “Percentage of logs relative to other elements” parameter, which is set to 50 by default |
| ST-PR-027 | Variables with prefix | Process | Warning | The process contains a variable without a prefix. The rule has 5 templates for variables of different data types, where you can specify recommended prefixes |
| ST-PR-028 | Repetitive elements in process | Process | Warning | There are repeating parts with the same functionality in the process, that can be moved to a sub-process. The rule has a “Percentage of repeating elements” parameter, which is set to 50 by default |
| ST-PR-029 | Nested containers | Process | Warning | There are nested containers “Open Browser”, “Attach Browser”, “Attach Application” in the process. The rule has a “Threshold” parameter, where you can specify the allowed nesting threshold. Default is 2 |
| ST-PRJ-003 | Description for the project is not specified | Project | Warning | You did not specify a comment in the “Description” field when creating/editing the project |
| ST-PRJ-004 | Similar processes | Project | Warning | There are similar processes with the same functionality in the project, that can be moved to a sub-process. The rule has a “Percentage of repeating elements” parameter, which is set to 50 by default |
You can also develop your own code analysis rules.
Last updated on