Code Review Standards

Could you please share me some details regarding the coding standards that we need to check during code review. Is there any tool available or documentation?

1 Like

The coding standards to be maintained are mentioned in this video.

You can also refer below links for best automation practices.

7 Likes

What you check for is subjective and will depend on what you or your organisation decides is important.

For our code reviews, we check the code against our documented design best practices for things such as naming conventions of variables, annotations etc. We then check against a checklist which includes items like:

  • Is the code well structured (correct use of flow chart / state machine / sequence)?
  • How easy is it to read the code and understand what is happening?
  • Are actions undertaken in a logical order (e.g. validating a work item before carrying out any processing on it.)
  • Has the code been broken down into modules?
  • Have sequences been split out into reusable workflows where possible?
  • How easy is it to test and debug?
  • Are any values hard-coded?
  • Are variable values held in the appropriate place (e.g. as an Orchestrator asset or in a config file)
  • Are activities appropriately named?
  • Are useful annotations and comments used throughout?
  • Is the solution extensible? e.g. is it easy to add an email address to a list of recipients without having to alter the code to handle an additional iteration?
  • Are there any workflows that exist as different variants of the same function, where a reusable component could be made to replace them?
  • Are all objects (variables, arguments etc.) named in a way that makes them human understandable (e.g. all strings start with a prefix of ‘s_’, all data tables start with ‘dt_’ etc.)?
  • Is the scope of all variables appropriate? i.e. kept as small as possible but without creating duplicate variables.
  • Are try-catch blocks used appropriately?
  • Will unexpected / unknown exceptions be handled gracefully?
  • Are logs used for appropriate information at the appropriate level?
  • Are all applications properly closed after use?
  • Is all working data reset after use or in the event of a failure?
  • In the event of a catastrophic failure, can the robot pick up where it left off or will work be missed or worked twice?
  • Is data handled securely, using the appropriate data type and stored in appropriately secured locations?
  • Is it GDPR compliant?
  • Is the code efficient? (e.g. using the DataTable.select method instead of a for each loop)

This is just an idea of what you might look for. You could obviously add to this or disregard elements depending on whether or not they are appropriate for your automation case. The key word is ‘appropriate’!

I hope that helps.

20 Likes

Thanks for you inputs…Your tips are helpful :slight_smile:

Thanks vinutha, I will check

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.