Skip to Content

Analysis Rules

Built-in Rules

Сode analyzer has a built-in list of rules, shown in the table below.

CodeRuleScopeActionNote
MO-EX-001Empty Excel Application elementElementWarningIt is recommended to remove empty “Excel Application” containers
MO-OU-001Empty Outlook Application elementElementWarningIt is recommended to remove empty “Outlook Application” containers
PR-AN-001Continue on Error = trueElementWarningThe 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-001Project workflow counterProjectInformationShows the number of process files (*.ltw) in the project
ST-AN-002Process element counterProcessInformationShows the number of elements in one process
ST-PR-001Large number of argumentsProcessErrorThe process exceeds the allowed number of arguments. The rule has an “Argument Counter” parameter, which is set to 20 by default
ST-PR-002Empty Catch blockElementErrorThe element has an empty Catch block, so the exception from the Try block is not handled
ST-PR-003Multiple diagram levelsProcessErrorChecks the nesting of diagrams according to the permitted value. The rule has a “Levels” parameter, which is set to 2 by default
ST-PR-004Empty workflowProcessWarningThere is an empty process in the project. It is recommended to remove it
ST-PR-005Unreachable elementsProcessWarningThere 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-006Nested If ClausesProcessWarningThe 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-007Deeply Nested ActivitiesProcessWarningThe 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-008Incomplete IfElementWarningThe 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-009Variables Naming ConventionProcessWarningThe rule checks whether variable names comply with the naming convention. The rule has a “Regular expression” parameter for specifying a pattern
ST-PR-010Arguments Naming ConventionProcessWarningThe 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-011Variable Length ExceededProcessWarningThe 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-012Argument Length ExceededProcessWarningThe 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-013Prefix Datatable VariablesProcessWarningA variable of DataTable type must have a dt_ prefix
ST-PR-014Prefix Datatable ArgumentsProcessWarningA DataTable type argument must begin with the argument type and be followed by the dt_ prefix
ST-PR-015Argument Default ValuesProcessWarningUse default values ​​for arguments when testing individual processes
ST-PR-016Unused variablesProcessWarningThere are unused variables in the process; it is recommended to remove them.
ST-PRJ-001Package restrictionsProjectErrorThe 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-002Required packagesProjectErrorThe 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.zip to the Studio installation folder. Unpack it to the root folder so that the Primo.ProjectAnalyzer.Extended.dll library is at the same level as Primo.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.

CodeRuleScopeActionNote
ST-PR-017Default component nameElementWarningThe 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-018Infinite loopElementWarningThere 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-019Use of Generation 1 elementsElementWarningThere are elements from the “Generation 1” group in the process. It is better to use new elements instead
ST-PR-020Checking nesting of “Open Browser”, “Attach browser”, “Attach application”ElementWarningThe process has one or more of the specified containers with other containers nested in them
ST-PR-021Fixed delays in elementElementInformationThere 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-022Exception variable in Try-Catch block not specifiedElementWarningThere 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-023Nested loopsProcessWarningThere 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-024Annotation for main sequence not specifiedProcessWarningThere is no comment for developers in the process for the root sequence
ST-PR-025Project workloadProcessWarningThe 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-026Process overload with logsProcessWarningThere 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-027Variables with prefixProcessWarningThe 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-028Repetitive elements in processProcessWarningThere 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-029Nested containersProcessWarningThere 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-003Description for the project is not specifiedProjectWarningYou did not specify a comment in the “Description” field when creating/editing the project
ST-PRJ-004Similar processesProjectWarningThere 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