Integrating CodeScene with GitLab Merge Requests

CodeScene can be seamlessly integrated into your GitLab workflow to provide automated code reviews and enforce quality gates on Merge Requests. This integration helps your team identify potential issues early and maintain high code quality before merging changes into the main branch.


Step 1: Open the Pull Request Integration Settings

  1. Navigate to your project configuration in CodeScene.

  2. Go to the Pull Request Integration tab.

This section allows you to define how CodeScene interacts with GitLab Merge Requests and which analysis behaviors apply.


Step 2: Enable Merge Request Integration

CodeScene integrates with GitLab by installing a webhook in your GitLab project.
This webhook notifies CodeScene whenever a Merge Request is created or updated.

To enable the integration:

  1. Check the box “Enable pull request integration for this project.”

  2. Select the Quality Gates profile that defines which checks CodeScene should enforce. We recommend starting with the Bare Minimum profile.

You can:

  • Customize settings per project to align with your specific quality standards, or

  • Use the global quality gates configuration to apply a consistent policy across all projects.

Click Update to save your changes.


Step 3: Configure Commenting Options

CodeScene posts analysis results directly as comments in your GitLab Merge Requests.
You can adjust how and when CodeScene comments using the following options:

Always comment on all Merge Requests

By default, CodeScene comments only when:

  • A Merge Request fails a quality gate,

  • The predicted risk level is high (recommending a more detailed review), or

  • Warnings are triggered.

Enabling this option makes CodeScene comment on all Merge Requests, even low-risk ones, providing broader visibility into code quality.

Post a comment when a Merge Request check is pending

When enabled, CodeScene posts a comment as soon as it receives the webhook, indicating that the Merge Request analysis is in progress.

Add discussions to specific file locations

Instead of posting a single summary comment, CodeScene can add discussions on specific lines of code where degradations or improvements were detected.
This makes it easy for reviewers to address issues directly in context.

Don’t resolve discussions for high-risk Merge Requests

If enabled, discussions remain unresolved for Merge Requests with high predicted risk, even when no degradations are found - ensuring that reviewers give these changes extra attention.


Step 4: Test the Integration

To confirm the setup:

  1. Create a new Merge Request in GitLab.

  2. CodeScene will automatically analyze the changes and post its feedback as comments or discussions directly in the Merge Request.


With this setup, CodeScene becomes an integrated part of your GitLab development workflow, providing early insights, enforcing quality standards, and helping your team continuously improve code health - all before the merge happens.