Skip to main content
Version: 2022

Code review

Introduction to code review

menu Quality > Code review

The Code review screen shows the control procedures and templates marked for review.

note

Not every project requires a code review. Therefore, a setting named Code review required is available in the menu Maintenance > Configuration. Uncheck this setting to hide the tasks for (dis)approving code and the validations regarding the not yet (dis)approved code. See also Configuration.

1536918582964 Code review

Assign a code reviewer

menu Quality > Code review > tab Code review

The control procedure can be assigned to a reviewer with the Assign to reviewer task.

Assign to reviewer Assign to reviewer

Tab Assignments shows an overview of the amount of unassigned review tasks, and assigned tasks each developer.

View code changes

menu Quality > Code review > tab Changes

The Changes tab shows the control procedure code and/or template code that has changed.

  • Compare template Use the Compare control procedure and Compare template tasks to preview the changes using an external compare tool like WinMerge.
  • Add Comments to inform the developer of any errors or possible optimizations in the code.

Test code changes

menu Quality > Code review > tab Unit tests

When reviewing control procedures, it is helpful to run the accompanying unit tests to ensure the code is running as intended.

A badge displays the number of unit tests available for the control procedure.

For more information, see Unit tests.

Analyze code

menu Quality > Code review > tab Code analysis

The Code analysis tab allows you to perform an automated static code analysis on the generated T-SQL code.

After running the Code Analysis Analyze code task for a specific control procedure, icons show the warnings or errors for each program object. Issues that have to be resolved before code changes can be approved need to be added manually to the code review comments.

image292 Code analysis

The code analysis will check over 60 rules covering, for instance:

  • Type checking
  • Use of patterns in LIKE predicates
  • Potential SQL Injection Issue
  • Avoid cross server joins
  • Deprecated JOIN syntax
  • Use two part naming
  • Use of nolock / UNCOMMITTED READS
  • Use of Table / Query hints
  • Use of Select *
  • Explicit Conversion of Columnar data - Non Sargable predicates
  • Ordinal positions in ORDER BY Clauses
  • Change Of DateFormat and DateFirst
  • SET ROWCOUNT
  • Missing Column specifications on insert
  • SET OPTION usage
  • Use 2 part naming in EXECUTE statements
  • SET IDENTITY_INSERT
  • Use of RANGE windows in SQL Server 2012
  • Create table statements should specify schema
  • View created with ORDER
  • Writable cursors
  • SET NOCOUNT ON should be included inside stored procedures
  • COUNT(*) used when EXISTS/NOT EXISTS can be more performant
  • Use of TOP(100) percent or TOP(>9999) in a derived table.

Approve or disapprove code changes

menu Quality > Code review > tab Code review

Tasks are available to approve or disapprove the changes. When approved, the control procedure will be set to completed. When disapproved, a comment is required as review feedback, and the control procedure will be set back to development.

  • Approve Approve changes
  • Disapprove Disapprove changes.

Resolve comments

menu Business logic > Functionality

Any comments made by the reviewer are also available in the Functionality screen, linked to the changelog.

You can choose to resolve the comments or mark the comment as won't fix and optionally explain this decision by replying with a comment. When done, you can set the procedure to review again.

If not all comments have been unresolved when you set the procedure to review, you will be notified.

Icons in the Functionality screen indicate the development and review status of control procedures:

IconDescription
Currently in development by another developer
Currently in development by current developer
Changes are disapproved, in development by current developer
Waiting for review, developed by current developer
Ready for review, developed by another developer

Review comments

Assignments

menu Quality > Code review > tab Assignments

The Assignments tab shows an overview of the code review tasks that are assigned to a developer.

code_review_assignments Assignments

Was this page helpful?