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. You can perform manual code reviews as well as use automatic AI code reviews.
Code review
Code review settings
Maintenance > Configuration
Code review is not required in all situations.
- To make code review mandatory, select Code review required. This setting affects all models. Clear it to hide the tasks for (dis)approving code and the corresponding validations.
- To use AI code review, select both Code review required and Use AI review. Now, you can automatically perform a code review on any control procedure that is set to the status review.
See also Configuration.
AI code review
The Software Factory can use AI to automatically perform a code review on any control procedure marked for review. You can use the AI review at the moment when you set a control procedure to review or on demand. In both cases, the model enrichment Template code review is used. See Model enrichment.
Prerequisites and disclaimer
Prerequisites for AI code review:
- Generative AI has been set up for the Software Factory. See Set up generative AI for the Software Factory.
- Both Code review required and Use AI review are selected. See Code review settings.
Generative AI is designed to assist human reviewers during the review process. You can disable the AI review if you prefer a human-only review. Help us improve the AI review by providing feedback! If you have any suggestions, feel free to create a topic in the Community.
AI code review when code is set to review
To use an automated AI code review on a control procedure when it is set to review:
menu Quality > Code review > tab Code review
- Start the task Ready for review to set a control procedure to review.
- Select the option Review by AI.
AI code review on demand
To perform an AI-powered code review when a control procedure is already under review:
menu Quality > Code review > tab Code review
- Execute the task Review template code with AI .
Results of AI code review
The code review is executed in the background. The control procedure templates are sent to OpenAI. It may take some time for the AI to complete its review.
After the review, the response is shown as separate comments on the tab Code review > Comments.
Code review comments by AI
Human 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.
Tab Assignments shows an overview of the amount of unassigned review tasks, and assigned tasks for each developer.
Review 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.
- 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. Comments are linked automatically to the selected change.
You can add general comments (not linked to a change) in tab All comments.
Add a comment to a specific change
Related screen for more context
menu Quality > Code review
When reviewing code, you may want to view its context. For example, the unaffected templates, previous code reviews, or even the entire program object code. To do so, execute the task Go to control procedure in Functionality (Alt + C).
See also Go to a related screen for an object.
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.
Approve or disapprove code changes
menu Quality > Code review > tab Code review
- Use the tasks to approve or disapprove the changes.
- Approve changes - the control procedure will be set to Completed.
- 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
- Execute the Undo task. This task only becomes available after approving or disapproving 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
Any comments made by the reviewer are also available in the Functionality screen (menu Business logic > Functionality).
- You can choose to Resolve the comments or mark the comment as Won't fix and explain this decision by replying with a comment.
- When done, set the procedure to 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.
Assignments