IntermediateLesson 6

Reports & Dashboards

ELI5 Explanation

SonarQube dashboards are the scoreboard for your code. They show how healthy each project is, what changed recently, and where the biggest improvements are possible.

Technical Explanation

The SonarQube UI provides project-level and portfolio-level views. Key metrics to understand:

The SonarQube API exposes all metrics programmatically, enabling custom dashboards in Grafana or PowerBI.

Tip: Share the project overview URL with product owners as a shared quality contract — not just with developers.

Visual

Project Overview
Ratings A–E
+
Coverage %
+
Debt Trend

Hands-on Commands

Pull metrics via SonarQube API
# Get coverage, duplications, technical debt for a project
curl -u $SONAR_TOKEN: \
  "http://localhost:9000/api/measures/component?component=my-app&metricKeys=coverage,duplicated_lines_density,sqale_debt_ratio,reliability_rating,security_rating"

# Get issues count by type
curl -u $SONAR_TOKEN: \
  "http://localhost:9000/api/measures/component?component=my-app&metricKeys=bugs,vulnerabilities,code_smells"

# Export project activity (trend)
curl -u $SONAR_TOKEN: \
  "http://localhost:9000/api/project_analyses/search?project=my-app"

Debugging Scenario

Dashboard shows coverage dropping week-over-week despite no test removals. Investigation: a generated code folder was accidentally included in coverage scope. Exclude it with sonar.coverage.exclusions=**/generated/**. Always validate coverage scope matches what developers actually own.

Interview Questions

Beginner

  • What does test coverage in SonarQube measure?
  • What does code duplication indicate?
  • What is the technical debt ratio?
  • What does a Reliability Rating of E mean?
  • Where do you see Quality Gate results in the dashboard?

Intermediate

  • How would you use the SonarQube API to build a custom team quality report?
  • How do portfolio views help engineering leadership?
  • What trends in the activity view indicate an unhealthy project?
  • How do you present SonarQube data in a sprint review?
  • What does duplication above 20% tell you about a codebase?

Scenario-based

  • Coverage is 85% but team still ships bugs. What does this suggest?
  • Debt ratio jumps from 3% to 18% in one sprint. What do you investigate?
  • Management asks for a monthly quality trend report. How do you automate it?
  • A project has rating A everywhere but still fails quality gate. Why might this happen?
  • You need to demonstrate quality improvement to an auditor. What report do you produce?

Real-world Use Case

An engineering team embedded the SonarQube project overview into their weekly engineering health meeting. Coverage trend and debt ratio became shared team metrics, not just developer concerns.

Summary

Dashboards and reports make quality visible to the whole team, driving accountability and continuous improvement. Next you will integrate SonarQube into CI/CD pipelines to make these checks automatic on every commit.