Setting up SonarQube: from Docker to quality CI/CD

Code review often becomes a formality: rules are configured once and forgotten, and defects reach release. We deploy and configure SonarQube for your build pipeline — turnkey, with clear policies and support. The quality gate becomes transparent for the team, and manual review frees up engineers' time.

Our competencies:

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1365
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1330
  • B2B Advance company logo design
    B2B Advance company logo design
    776
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1077
  • AIDER company logo development
    AIDER company logo development
    1022
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1113

Setting Up SonarQube: Where Code Analysis Breaks Down

SonarQube in a container comes up in an evening, and the analysis rule is formally enabled on the first day.

Then the same picture repeats in almost every project: false positives accumulate faster than they can be triaged, the check complains about generated code, tests, and outdated modules where a fix will improve nothing.

The build fails for no good reason — on a line no one touched — and developers start bypassing the check: adding exceptions, lowering the quality gate, or silently forcing a branch merge.

The cause is not the tool. The quality profile is taken out of the box, thresholds are the same for a new service and ten-year-old legacy, and review runs across the entire repository instead of changes in the branch.

Code analysis stops showing dynamics: the team sees thousands of issues at once and cannot tell which are blocking and which are just background.

The price of such a mode is not lost hours but vanished feedback. Technical debt in the report looks the same both at the start of work and a month later, because the metric is not broken down by module and not tied to changes.

Noise eats away trust: if more than half of the hits are false, real findings are read half-heartedly — and a failing build stops being a signal.

We look at how this is closed: setup begins not with installation but with calibration — which rules are mandatory, where the quality gate is made stricter, and where it is temporarily softer with a review date.

What a Well-Built Code Quality Check Delivers

While quality checking lives separately from the pipeline, defects surface in review or already in production, where fixing costs many times more. SonarQube is integrated at the moment when code can still be fixed cheaply — before the branch merge.

Rule Profile and Quality Gate

We assemble the rule profile for the project's stack: remove noisy checks, keep those that catch real classes of defects — unsafe database queries, connection leaks, unhandled exceptions, duplicated blocks.

We tie the quality gate to new code, not old: the team does not drown in accumulated issues, but changes that do not pass the check do not get into the branch.

Analysis is configured for changed files with intermediate caching per branch — check time drops from dozens of minutes to a few, and the build stops being a bottleneck.

The share of blocking defects in new code stays near zero: what passed the gate no longer contains errors that previously reached release.

Integration with the Code Repository

The repository emits an event for every merge request, analysis starts automatically, and the result is returned as a comment on the change: which files and lines violate the rules.

If the quality gate is not passed, the merge is blocked — issues are not triaged manually after release.

The result is a class of failures that has gone away: null dereferences, unhandled exceptions, forgotten access right checks. Static analysis catches them before tests run, so the pipeline remains predictable, and review discussion is about logic, not style and typos.

Analysis Modes: Local Run, Server, Selective Check

Quality rules can be applied in three modes, and the choice of mode determines how quickly an engineer gets feedback. A local run is deployed on the developer's machine, the check server — in the shared environment, and selective control covers only changed files.

On SonarQube these modes are compatible with each other and use one set of rules — only the data source and launch timing change.

Local Run, Check Server, and Selective Control

Option When It Fits Limitations
Local run in a container A change needs to be checked before sending to the shared branch Analysis runs on a local copy: no history, metrics from previous releases, or common benchmark for the team
Check server in the shared environment Unified rules are needed for all branches and dynamics by version Requires service and database maintenance; the result comes after the code has already been sent
Selective check of changed files Large repository, full run takes a long time Does not see connections between modules — some defects remain outside the check

Analysis Limitations

No single mode replaces another: a local run saves time on fixes, the server mode sets the common benchmark, and the selective mode relieves long builds.

A reasonable scheme is a quick run on changed files with every edit and a full analysis on the server before building the release.

It is worth remembering: analysis catches defects in code, but not architectural miscalculations or duplicated logic between services.

False positives are suppressed with pinpoint exceptions in the configuration, not by disabling rules entirely — otherwise the quality bar drops unnoticed.

Setting Up SonarQube for Your Build Pipeline

A code analyzer works only when it is embedded in the build pipeline: the issue arrives while the change is still remembered, and the check status is visible where changes are discussed.

Below is the order of work after which SonarQube becomes part of the team's discipline rather than a separate task.

Review of Current State and Deployment Scheme

  1. We look at how the build pipeline is organized now: where the check runs, which branches are main, how long a full run takes. Otherwise analysis will slow the build or trigger on the wrong changes.
  2. We agree on the deployment scheme: analyzer server, report storage, build agents — source code and results do not leave your environment. We define access rights on an individual basis: who sees reports, who changes the profile, who dismisses an issue. Otherwise quality becomes a matter of dispute, not a process.

Setting Up Rules and Acceptance Testing

  • We configure rules for your code: we calculate the gate by new code, not the entire repository — accumulated debt does not block work, and new changes come in clean.
  • We connect the check to the pipeline: launch on every merge, status returned to the version control system, the build stops only on critical issues.
  • We conduct acceptance testing on a live project: real merges, reproducibility of issues, run time, disabling false positives.
  • We hand over the deployment scheme, the procedure for working with issues, and access rights — after that the team runs the analyzer itself.

What We Hand Over: Configurations and Procedures

Based on the setup results, we hand over not a “working server” but a kit that the team can use to proceed without us. Everything is tied to your repository, your languages, and release branches, and tested on real changes, not on a demo example.

Configuration Artifacts

  • Rule profiles for each project language: what is enabled, what is intentionally disabled, and why.
  • Analysis configuration files in the repository: the same run for developers and in the build.
  • Deployment scheme: where the analyzer runs, where reports are stored, what to do when unavailable.
  • Access policies: roles, rights to change profiles, procedure for closing issues.
  • Quality Gates for the main branch and release branches: which conditions block a merge.

Instructions and Maintenance Procedure

  • Instructions for the team: local run before sending changes, report triage, handling false positives.
  • Maintenance procedure: frequency of rule reviews, exception procedure, person responsible for the profile.

As a result, the team gets a foundation: rules do not change silently, exceptions are documented in writing, and the quality of new code is discussed based on the report, not on feelings.

From Practice: How We Reduced Check Time and the Number of Defects

When the team came with the task “pre-release checks are slowing down releases,” we started not with settings but with metrics: how long analysis takes, what share of issues actually blocks release, and how often a release is rolled back. Without these numbers, any setup of SonarQube turns into guessing at thresholds.

How It Was

A full analysis was run manually, took about 40 minutes, and covered the entire branch — it was postponed until the last day before release.

The rule profile was default: everything worked as warnings, there were zero blocking issues, and by release more than three hundred open issues accumulated.

The result was three release rollbacks per quarter, manual analysis of the causes of each, and reviewers who spent time on style instead of logic.

What Changed

Analysis was split into two passes: a quick one on changed files when merging into the main branch and a full one on a nightly schedule.

The pass condition was formulated strictly — new lines do not add blocking issues, test coverage of new code is not below the specified threshold, and accumulated debt of old modules was excluded from blocking: otherwise development would have stopped at the first merge.

Checking changes takes 5–7 minutes instead of 40, blocking issues per release — zero, rollbacks per quarter — zero. Arguments about thresholds stopped, and reviews are again about the logic of decisions.

How Does Built-in Control Differ from a Separate Check Server?

Built-in control lives inside the code repository and runs on every merge: it checks dependencies for known vulnerabilities, looks for secrets that have made it into the repository, and catches typical errors.

There is almost nothing to configure there — the rules are set by the platform, and the blocking threshold is changed with a couple of toggles.

A separate server is SonarQube or an equivalent: its own rule profiles for each language, a unified quality gate as a merge condition, metrics for coverage, duplication, and technical debt.

One screen shows the state of all repositories, and issues are distributed to teams as tasks, not as a faceless report.

The comparison of options comes down to three questions: how many repositories and languages, whether a blocking coverage threshold is needed, and whether a check report must be presented.

Built-in control requires no maintenance, but its rules cannot be extended for project specifics. A separate server must be maintained — updates, rule base, access rights — but checks become the same for all teams.

The transition is done without stopping work: the server is brought up alongside, profiles are transferred, and results are compared on the same branches so as not to get hundreds of issues at once on the first day.

Then the check is enabled as a blocking condition for new edits, and for old code a baseline snapshot is fixed and monitored so that debt does not grow. Built-in control remains a quick filter for secrets and vulnerable dependencies — it triggers earlier than heavy analysis.

Questions About Deployment and Maintenance

Before launch, the same questions usually come up: will the check start slowing down the pipeline, will the team drown in issues on inherited code, will reports remain in our environment. We answer briefly; details are one click away.

Can only changes be analyzed, rather than the entire repository?

Yes, this is a standard mode. We define the concept of “new code” — by reference branch, previous version, or history depth — and the Quality Gate evaluates only that. Legacy is fixed by a baseline: it does not block the build, and debt is closed as files are edited.

How are false positives marked?

Marking is done in the server itself: an issue is marked as false or “won't fix” with a comment explaining the reason — it does not surface on the next run. We allow an exception directly in code only with an explanation. We disable consistently noisy rules in the quality profile for a specific project, not globally.

How much will build time increase?

The scanner runs as a separate stage after tests; on large repositories we enable partial history upload and a cache so as not to reindex unchanged parts.

We send the report asynchronously — the pipeline does not wait for the verdict; the branch gets a status when the server has processed the data.

Where are the results stored and who maintains them?

The server is deployed in your environment: reports and history do not leave it; the database, snapshots, and retention periods are configured according to your policy.

Then — updating images and rules, cleaning history, rotating tokens, backups: we provide maintenance on an agreed schedule.

Let's Discuss the Task and Come Back with an Estimate and Plan

Setting up SonarQube begins not with installation but with an inventory: as long as it is unclear where the code comes from, how builds are launched, and who approves quality rules, any timeline estimate will be approximate. Below is what we need from you so that we can come back with a work plan and realistic timelines.

  • Repositories and branching model: where the code is stored, which branches are long-lived, whether checking changes before merge is mandatory.
  • Integration points: which continuous integration system is used, where builds are launched, whether there are custom agents and network restrictions.
  • Access and input data: repository read access, build configurations, descriptions of test benches and test environments.
  • Current quality state: whether there are linters, static analyzers, and automated tests, and what share of paths is covered by checks.
  • Quality rules: which checks must block a merge and which are enough to show as an issue.
  • Infrastructure: where to host the analysis server, requirements for resources, backup, and updates.
  • Person responsible on your side: who approves quality rules and gets the team involved in issue triage.

This is enough to estimate the effort and put together a work plan with stages, dependencies, and implementation order.

Describe the task and current infrastructure — we will come back with a timeline estimate and plan; as the next step, we will agree on the scope of the first stage.