Subscribe

UiPath Studio

The UiPath Studio Guide

About Workflow Analyzer

Workflow Analyzer is a static code analyzer that ensures your project meets high quality and reliability standards. A static code analyzer checks for inconsistencies without actually executing the project, as opposed to dynamic analyzers which step in during execution.

Workflow Analyzer uses a set of rules to check for various inconsistencies unrelated to project execution. The rules are based on Automation Best Practices and take into consideration variable and argument naming, empty sequences or workflows, package restrictions, and so on. The analyzer does not identify errors in execution or compilation.

1119

It is available in the Design ribbon tab, the Analyze File and Analyze Project buttons. The first performs an analysis on the file currently focused in the Designer panel, while the second analyzes all files in the automation project.

Studio comes with a set of built-in rules, identifiable by the ST- prefix. UIAutomation.Activities also has a set of its own rules, identifiable by the UI- prefix.

Rules Naming Convention

Each rule has an ID, name, description, and recommendation. The ID contains the origin, category, and number. For example, Variables Naming Convention has the ST-NMG-001 ID:

808

Managing Rules

The project or file is analyzed based on a set of rules available in the Project Settings window:

  • In the Project panel, click the settings_icon icon, then select Workflow Analyzer.
  • In the ribbon, click the Analyze File button, then select Workflow Analyzer Settings from the dropdown.

Rules can be filtered by scope and action. Uncheck the box next to each rule to define a configuration specific to your project.

1068

Scope

Each rule has a scope to which it applies:

  • Activity: The rules are enforced at activity level, checking variables, arguments, properties. Variables Naming Convention is one such rule.
  • Workflow: Rules perform checks in a single project file, for example Unused Variables.
  • Project: Checks are performed at project level.

Action

Rules have a number of actions that can be set:

  • Error: Generates an error in the Error List panel.
  • Warning: Generates a warning in the Error List panel.
  • Info: Generates a message in the Error List panel.
  • Verbose: Creates large log files.

Check the Logging Levels page to learn more about logging with Studio.

Reset to Default

After any changes were made to the default values of rules, be it Regex or thresholds, the values may be reverted to default by right-clicking the rule and then selecting Reset to Default.

997

Validation

Validation of the file or project is performed whenever the Workflow Analyzer is triggered. Validation options are available in the Analyze File ribbon button, Validate File and Validate Project.

This action checks whether variables, arguments, expressions, and imports are properly configured. The Validate File action can be triggered using the F8 shortcut, while Validate Project using Shift + F8. Validation can be cancelled at any time.

The file(s) that contain errors are marked in the Project panel with a red dot, and the errors are shown in the Error List and Output panels.

Double-clicking an item in the Error List panel opens the .xaml and highlights the activity which threw the error.

Unless all .xaml files are validated, the project cannot be debugged, executed or published. Breakpoint conditions are not evaluated.

Managing Errors

When triggered, the Workflow Analyzer uses the configured ruleset to check the project or file, and logs the found errors in the Error List panel, in accordance with the rule action.

1068

The Error List panel filters items by Errors, Warnings and Messages. The scope drop-down menu is useful for filtering errors by project, current file or a specific file in the automation. In addition, items can be filtered by rule ID.

1180

Click a found warning or error to display the rule’s recommendation and a link to the documentation page for each rule.

When validating or analyzing a process containing activities from unresolved dependencies, the Error List panel displays the found error together with a recommendation and link to the documentation.

Command-Line Support

The UiPath.Studio.CommandLine.exe command-line user interface contains a set of parameters for checking files or projects against certain rules, even in CI/CD pipeline configurations.

UiPath.Studio.CommandLine.exe is available in the installation folder:

  • For the Windows Installer (.msi) version of Studio, the default path is C:\Program Files (x86)\UiPath\Studio\
  • For Studio installed in User Mode (.exe), the default path is %LocalAppData%\UiPath\[Studio_version]\.

Configure Rules

By default, all Workflow Analyzer rules are enabled when installing Studio. Configure rules directly from Studio:

  • From the Workflow Analyzer Settings window, enable or disable rules by clicking the checkbox next to each one of them,
  • From the RuleConfig.json file, path %LocalAppData%\UiPath\Rules. Find a specific rule, modify its parameter, change the IsEnabled parameter to false to disable the rule.

Rules are organized according to their unique ID, visible in the Workflow Analyzer Settings also.

For example, in the image below only the Variables Naming Convention rule was enabled and received the ([A-Z]) Regex expression. This means that variable names must be uppercase. All the other rules were disabled in this example.

625

Analyze Files and Projects

After configuring the rules, access the UiPath.Studio.CommandLine.exe command-line user interface.

Workflow Analyzer commands are the following:

  • analyze - Analyzes the whole project. Requires the path to the project.json file.
  • analyze-file - Analyzes a single file. Requires the path to the .xaml file.

In the example above, the following command analyze -p "C:\Users\username\Documents\UiPath\BlankProcess\Main.xaml" checks if the variable names are uppercase in one .xaml file.

1099

The output of the above command returns a .json encoded dictionary with the following type of information:

  • ErrorCode : The rule ID.
  • ErrorSeverity: The value of the DefaultAction parameter, which is the configured log message for each rule, either Warning, Error, Info or Verbose.
  • Description: The rule's description.
  • Recommendation and URL: The recommended changes for solving the issue, together with the documentation link with more information.
  • FilePath: The path to the analyzed file.

Please note that some of the entries may not be associated with a rule, but can be errors generated by the Workflow Analyzer. For example, in the case of an empty .xaml` file, an error is displayed.

The Globally Unique Identifiers (GUID) used as prefixes for an entry are generated on each run and apply to the current result only.

Updated 2 years ago


About Workflow Analyzer


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.