Read and Review Automation Anywhere Documentation

Automation 360

Close Contents

Contents

Open Contents

Code analysis

  • Updated: 2022/07/14
    • Automation 360 v.x
    • Manage
    • Enterprise

Code analysis

Important: Code analysis functionality in Automation 360 v.25 is a beta level implementation in limited preview. We plan to enable this functionality in Automation 360 Cloud in August 2022 and make it available on v.25 On-Premises the week of July 18, 2022.

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.

Benefits

Code analysis provides you the following benefits:
  • 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

User roles Value
Citizen Developer or RPA Developer Code analysis provides guidance to develop automations that meet organizational requirements for the following:
  • Error reduction
  • Code readability and maintenance
  • Code security
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:
  • Facilitate the development of automation by a larger pool of business personnel, for example, a Citizen Developer who might not have strong software development skills.
  • Improve maintenance of automations by reducing code complexity and improving readability.
  • Improve reliability of automations by reducing errors.
  • Improve security and compliance of automations by enforcing secure coding practices.
  • Reduce production time and costs of automation.

Permissions

You require the following permissions to set up a code analysis policy.
  • 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.

Components

  • 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.
The following table lists the rules and their description that can be used with code analysis:
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
  • Minimum length: Specify the minimum number of characters that the variable name must have.
  • Maximum length: Specify the maximum number of characters that the variable name can have.
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.

Report

You can access the code analysis report from the Automation page after running code analysis in the form of a downloadable CSV file. The report contains the results of the code analysis policy, detailing the violation, the location of the violation, and the bot file location:
  • 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:Example code analysis report

Set up code analysis

  1. Enable code analysis in the Control Room:
    1. Log in to the Control Room as an administrator.
    2. Navigate to Administration > Policies.
    3. Click Enabled in the Status section.

      By default, this feature is not enabled.

    4. Set up one or more rules in the Rules section.

      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.

  2. Run code analysis to validate your automation for the defined rules.
    1. Log in to the Control Room as a Citizen Developer or a Bot Creator (RPA Developer).
    2. On the left panel, click Automation.
    3. 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.

    4. Download the CSV file to analyze the report and make changes accordingly to your bot.
Send Feedback