Configuring SonarQube Code Quality Checks in CI Pipelines: Issues and Preview Modes
This article explains how continuous delivery pipelines rely on SonarQube for code quality enforcement, compares the Issues and Preview modes for displaying analysis results in commits, and provides the necessary SonarQube command‑line parameters to configure each mode in a CI/CD workflow.
The core of continuous delivery is the pipeline, and the most critical step within the pipeline is ensuring code quality; typically, quality checks are enforced in both the commit and integration pipelines, with configuration guidance available in the official SonarQube documentation.
Issues mode displays related information in the commit view while detailed analysis must be viewed on the SonarQube platform, making it suitable for configuration in the commit pipeline.
Preview mode also shows information in the commit view, but it can pinpoint the exact code line of an issue; the SonarQube platform does not store any data for this mode.
To configure SonarQube for either mode, add the appropriate SonarQube parameters to your CI job, specifying the analysis mode, GitLab project ID, commit SHA, and branch name, for example:
-Dsonar.analysis.mode=preview -Dsonar.gitlab.project_id=${projectid} -Dsonar.gitlab.commit_sha=${commit_sha} -Dsonar.gitlab.ref_name=${branchName}Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
DevOps Cloud Academy
Exploring industry DevOps practices and technical expertise.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
