Subscribe

UiPath Studio

The UiPath Studio Guide

ST-NMG-001 - Variables Naming Convention

Rule ID: ST-NMG-001

Scope: Activity

Description

Variables in a project should follow a specific naming convention to make it easier to understand the purpose of the variable and to maintain it. The variable name should be meaningful to accurately describe its usage throughout the project.

This rule analyzes all variables in the project and determines whether they follow the specific convention. If not, a message is logged in the Error List panel.

Recommendation

Make sure all the variables follow the naming convention. The rule checks that variable names abide by this default Regex expression ^([A-Z]|[a-z])+([0-9])*$.

According to the above Regex expression, the variable name abides by the rule if it starts with a lower or upper case letter, followed by a lower or upper case letter, and then one or more numbers.

For example, if the variable name in the workflow is HelloWorld1 then it matches the default Regex expression set in this rule.

Modifying the Rule

In the Project Settings window, select the Workflow Analyzer tab. Find the rule and select the rule, as in the image below:

875

In the Regex section, add or remove characters from the search pattern. For example, if we remove the [A-Z] part of the expression, the search pattern becomes ^([a-z])+([0-9])*$. Now the rule checks if variables start with a lower case letter and are followed by a number.

If we add [a-z]|[A-Z]), then the rule becomes ^([A-Z]|[a-z]+[a-z]|[A-Z])+([0-9])*$, and recognizes HelloWonderfulWorld as a valid variable name.

Examples of Regex Expressions

The default regex expression for this rule can be changed to another naming convention. Check the list below:

Camel Case

The camel case convention specifies that each word in the middle of the variable name begins with a capital letter, with no intervening spaces or punctuation.

Example of Regex expression: ([A-Z]|[a-z]|[0-9])+([A-Z]|[a-z]|[0-9]).
Valid variable names: Hello1World2, helloWorld, Hello1World.

Pascal Case

The Pascal case naming convention specifies that the variable name must contain concatenated capitalized words.

Example of Regex expression: ([A-Z]|[0-9])+([A-Z]|[a-z]|[0-9]).
Valid names: Hello1World2, HelloWorld, Hello1World.

Kebab Case

The Kebab case naming convention is similar to the Snake case, except that it replaces spaces with hyphens rather than underscores.

Example of Regex expression: ([a-z]|[A-Z]|[0-9])([\w-]+)+([a-z]|[A-Z]|[0-9])
Valid names: Hello1‐World2, Hello‐World.

Reset to Default Values

The default value for ST-NMG-001 Regex is ^([A-Z]|[a-z])+([0-9])*$.

Some Workflow Analyzer rules have default values. To reset these values to default right-click a rule in the Project Settings window, and then click Reset to default.

997

Updated 3 years ago


ST-NMG-001 - Variables Naming Convention


Suggested Edits are limited on API Reference Pages

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