Skip to content

Code Quality (SonarQube)

Coding conventions and standards (owned by the Architect/Dev Lead) set the bar; SonarQube measures whether we clear it. Every change is scanned, and because the results are concrete numbers, we drive them in the right direction over time.

Code is scanned twice, by two complementary reviewers, before it can merge:

flowchart LR
    DEV[Developer writes code] --> AIS[AI agent reviews & pre-scans]
    AIS --> PR[Pull Request]
    PR --> SQ[SonarQube scan in CI]
    SQ --> GATE{Quality gate pass?}
    GATE -->|fail| FIX[Fix issues] --> PR
    GATE -->|pass| QE[Quality Engineer review] --> MERGE([Merge])

The AI agent catches issues at authoring time; SonarQube enforces the objective gate in CI; the Quality Engineer owns the human judgment. This is the augmented-review pattern applied to code quality - see also Integration & Governance.

A pull request must pass the SonarQube quality gate to merge. The gate is a set of measurable conditions:

FactorStandardWhy it matters
Unit test coverage≥ 75%Confidence that behavior is verified; the project baseline.
Code complexityWithin agreed cyclomatic/cognitive limitsLower complexity = easier to read, test, and change safely.
DuplicationsBelow the agreed threshold (e.g. < 3%)Duplicated code multiplies bugs and maintenance cost.
Blocker issues0Blockers are defects that will break in production - none may ship.
Security issues0 new vulnerabilities / unreviewed hotspotsSecurity defects are non-negotiable; scanned every build.
Reliability & maintainabilityRating at or above targetAggregate health of bugs and code smells.

What “measure → improve” looks like here

Section titled “What “measure → improve” looks like here”

Every factor is a number, so every factor is improvable. We track the gate results sprint over sprint and act on the trend:

xychart-beta
    title "Unit test coverage trend (%) vs 75% standard"
    x-axis [S1, S2, S3, S4, S5, S6]
    y-axis "Coverage %" 0 --> 100
    line [62, 66, 71, 74, 77, 80]
    bar [62, 66, 71, 74, 77, 80]

Typical improvement actions, decided at the Retrospective:

  • Coverage below 75% → add tests to the weakest modules first; block new untested code via the gate on new code.
  • Rising complexity → targeted refactoring; AI-assisted extraction of methods/classes.
  • Duplication creeping up → consolidate shared logic; flag in AI review.
  • Recurring security findings → fix the pattern, not just the instance; tighten standards.
ReviewerStrengthLimit
DeveloperIntent, domain contextBlind spots in their own code
AI agentTireless, consistent, broad coverageMisses domain nuance; can be confidently wrong
SonarQubeObjective, repeatable measurementMeasures rules, not whether the solution is right
Quality EngineerFinal judgment & accountabilityTime - which is why the first three exist

The combination is deliberately layered so each catches what the others miss, while a human stays accountable for the merge.