Code analysis enables you to evaluate a program without running the code. In Automation 360, the code analysis feature analyzes the code and displays a list of violations based on set rules. You can review and fix any coding or stylistic errors for your automation.
Code analysis enables you to form certain code structures with which you can implement coding best practices and make the code maintainable, reliable, efficient, and secure.
- Implement coding best practices by enforcing certain coding conventions.
- Authorize Citizen Developer to introduce new automations.
- Enable complex automations to be more accessible.
- Improve code readability and quality.
- Control the structure of your automation code.
- Improve productivity of the developer and the platform as good policy enforcement increases the automation quality over time.
Code analysis for user roles
|Citizen Developer or RPA Developer||Code analysis provides guidance to develop automations that
meet organizational requirements for the following:
|Lead RPA Developer||Configure code analysis policies that define coding best
practices in the organization. Monitor and report the status of
code quality based on adherence to these policies. Code analysis
enables certain coding practices and principles to be enforced
which in turn helps with the following:
- View policies: Allows you to view the code analysis policy that defines how you can build your automations.
- Manage policies: Allows you to view and edit the code analysis policy that defines how you can build your automations.
- Policy editor: Contains a global policy for all Control Room users.
- Rules: As the foundation of code analysis, rules help to evaluate bot code. Rules can be simple or complex depending on the evaluation that is 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 to indicate the nature of evaluation to be performed on the code.
|Rule code||Rule description||Rule configuration|
|BOT-GEN-1||Specify the maximum number of lines of code.||Specify the maximum number of lines of code that the bot can have.|
|BOT-VAR-1||Specify variable naming convention.||Choose the option for the naming convention.|
|BOT-VAR-2||Specify character length for variable names||
|BOT-VAR-3||Do not allow unused variables inside the bot code.||Enable this rule to prohibit unused variables within the bot code.|
|BOT-COM-1||Require header comments.||Enable this rule to ensure that the first command action in the bot code is a comment.|
|BOT-HRD-1||Do not allow hard-coded values in Delay.||Enable this rule to require that the duration of delays must be set with a variable.|
|BOT-HRD-2||Do not allow hard-coded values in folder or filepath (desktop file or folder paths).||Enable this rule to ensure that the folder and filepaths are set with a variable.|
|BOT-ERR-1||Do not allow empty Catch blocks.||Enable this rule to ensure that the Catch blocks have actions within them.|
- Rule code
- Rule error message description (with location of bot file as appropriate)
- Location of the bot
The following image shows an example code analysis report:
Set up code analysis
- Enable code analysis in the Control Room:
- Log in to the Control Room as an administrator.
- Navigate to .
- Click Enabled in the
By default, this feature is not enabled.
- Set up one or more rules in the Rules
You must set at least one rule to enable the code analysis feature.
After the policy is enabled, it is applied to all the users globally.
- Run code analysis to validate your automation for the defined rules.
- Log in to the Control Room as a Citizen Developer or a Bot Creator (RPA Developer).
- On the left panel, click Automation.
- From the list of available bots, select the bot to analyze. Hover over the action menu (vertical
ellipsis) located to the right of the bot name and
click Run Code Analysis.
A CSV file is generated with the results of the code analysis.
- Download the CSV file to analyze the report and make changes accordingly to your bot.