Skip to main content
Version: 2023

Code review

Introduction to code review

menu Quality > Code review

The Code review screen shows the control procedures and templates marked for review. Reviews are based on live code.

note

Code review is not required in all situations. Therefore, a setting named Code review required is available in the menu Maintenance > Configuration. This setting affects all models. Clear it to hide the tasks for (dis)approving code and the corresponding validations. 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 Assign to reviewer task.

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

View code changes and add comments

menu Quality > Code review > tab Changes

Tab Changes provides an overview of every change since the last time the control procedures have been completed. Here, you can see which control procedures and templates are new, updated, or deleted.

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

You can add general comments (not linked to a change) in tab All comments.

comment code change Add a comment to a specific change

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.

  1. Execute the Code Analysis Analyze code task for a control procedure.

    Icons show if a program object has warnings or errors.

  2. Manually add issues that need to be resolved before code changes can be approved 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

  1. Use the tasks to approve or disapprove the changes.
  • Approve Approve changes - the control procedure will be set to Completed.
  • Disapprove Disapprove changes - a comment is required as feedback, if not already added. The control procedure status will be set to Waiting for developer.

Undo a code change (dis)approval

It is possible to undo a wrong choice when reviewing a control procedure. Since this is not meant for making historical corrections, you can only undo the most recent (dis)approval for a control procedure.

menu Quality > Code review > tab Code review

  1. Execute the Undo undo task. This task only becomes available after approving approve or disapproving disapprove a control procedure.

The control procedure status will be reset to Review. The live code will be available for review again.

Resolve comments

menu Quality > Code review > tab All comments

note

Any comments made by the reviewer are also available in the Functionality screen (menu Business logic > Functionality).

  1. You can choose to Resolve resolve the comments or mark the comment as Won't fix won't fix and explain this decision by replying with a comment.
  2. When done, set the procedure to Review review again. If not all comments have been resolved, you will be notified.

Resolve comments in Code review

All comments overview

menu Quality > Code review > tab All comments

Tab All comments contains an overview of all comments on every change in the selected code review record. Here, you can also add a comment that is not linked to a specific change.

The automatically generated comments state whether a control procedure has been disapproved or retracted. The following situations and comments are possible:

  • Changes to the control procedure's code after it has been marked for review:
    • Title: "Control procedure was updated after it was submitted for review."
    • Comment: "The control procedure was updated by [Developer] after the changelog was submitted for review."
  • Changes to the template code after a control procedure has been marked for review:
    • Title: "Template was updated after it was submitted for review."
    • Comment: "The template code was updated by [Developer] after the changelog was submitted for review."
  • Changes to the status of the changelog or code review:
    • "Code review was retracted by [Developer]."
    • "Code review was disapproved by [Developer]."
    • "Code review has been reopened by [Developer]."

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?

Happy React is loading...