sonar_generate_report
Generate a comprehensive quality report from SonarQube analysis.
Description
Creates detailed quality reports in multiple formats. Useful for stakeholder communication, sprint reviews, and tracking quality trends over time.
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
format | string | No | summary | Report format: summary, detailed, json |
Format Options
| Format | Description | Best For |
|---|---|---|
summary | High-level overview | Quick status checks |
detailed | Full breakdown with all issues | Deep analysis |
json | Machine-readable format | CI/CD integration |
Usage
Summary Report
Give me a quality report summary
Tool call:
{}
Detailed Report
I need a full quality report with all issues
Tool call:
{
"format": "detailed"
}
JSON Format
Export quality data as JSON for our dashboard
Tool call:
{
"format": "json"
}
Response Format
Summary Format
╔══════════════════════════════════════════════════════════════════╗
║ QUALITY REPORT - SUMMARY ║
╠══════════════════════════════════════════════════════════════════╣
║ Project: my-awesome-app ║
║ Generated: 2024-01-15 14:32:00 ║
║ Analysis: Latest ║
╚══════════════════════════════════════════════════════════════════╝
📊 QUALITY GATE: ✅ PASSED
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📈 RATINGS OVERVIEW:
Reliability: A ████████████████████ (0 bugs)
Security: B ████████████████░░░░ (2 vulnerabilities)
Maintainability: A ████████████████████ (156 code smells)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 ISSUES SUMMARY:
│ Type │ Count │ Trend │
├─────────────────┼───────┼────────┤
│ 🐛 Bugs │ 0 │ ↓3 │
│ 🔓 Vulnerabilities│ 2 │ ↓1 │
│ 🔒 Hotspots │ 5 │ = │
│ 💭 Code Smells │ 156 │ ↓12 │
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 COVERAGE & DUPLICATION:
Test Coverage: 67.3% ████████████████░░░░░░░░░
Duplication: 4.2% ██░░░░░░░░░░░░░░░░░░░░░░░
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⏱️ TECHNICAL DEBT:
Total: 3d 4h
Ratio: 2.3%
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 RECOMMENDATIONS:
1. Fix 2 security vulnerabilities (estimated: 2h)
2. Review 5 security hotspots
3. Coverage target: increase to 70% (+2.7%)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Detailed Format
╔══════════════════════════════════════════════════════════════════╗
║ QUALITY REPORT - DETAILED ║
╠══════════════════════════════════════════════════════════════════╣
║ Project: my-awesome-app ║
║ Generated: 2024-01-15 14:32:00 ║
╚══════════════════════════════════════════════════════════════════╝
[Summary section as above...]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔓 VULNERABILITIES (2):
1. [CRITICAL] SQL Injection Risk
File: src/api/userController.ts:45
Rule: typescript:S3649
Message: Sanitize user input before SQL query
2. [MAJOR] Hardcoded Credentials
File: src/config/database.ts:12
Rule: typescript:S2068
Message: Remove hardcoded password
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔒 SECURITY HOTSPOTS (5):
[TO_REVIEW] 3 hotspots require manual review
[REVIEWED] 2 hotspots marked as safe
1. [HIGH] Weak cryptography
File: src/utils/crypto.ts:23
Status: TO_REVIEW
2. [MEDIUM] CORS configuration
File: src/server/middleware.ts:15
Status: TO_REVIEW
...
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
💭 CODE SMELLS BY SEVERITY:
MAJOR (45):
• Cognitive complexity issues: 23
• Long methods: 12
• Duplicate blocks: 10
MINOR (89):
• Naming conventions: 45
• Magic numbers: 28
• TODO comments: 16
INFO (22):
• Formatting issues: 22
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📁 TOP FILES BY ISSUES:
1. src/services/PaymentService.ts (23 issues)
2. src/utils/validators.ts (18 issues)
3. src/api/handlers/orderHandler.ts (15 issues)
4. src/components/DataTable.tsx (12 issues)
5. src/hooks/useApi.ts (8 issues)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
JSON Format
{
"project": {
"key": "my-project-a1b2c3d4",
"name": "my-awesome-app",
"version": "1.2.3"
},
"generated": "2024-01-15T14:32:00Z",
"qualityGate": {
"status": "PASSED",
"conditions": [...]
},
"metrics": {
"bugs": 0,
"vulnerabilities": 2,
"codeSmells": 156,
"coverage": 67.3,
"duplicatedLinesDensity": 4.2,
"technicalDebt": "3d 4h"
},
"ratings": {
"reliability": "A",
"security": "B",
"maintainability": "A"
},
"issues": {
"byType": {...},
"bySeverity": {...},
"byFile": [...]
}
}
Examples
Example 1: Sprint Review
Prompt:
Generate a report for our sprint review meeting
Tool Call:
{
"format": "summary"
}
Example 2: Technical Analysis
Prompt:
I need a detailed breakdown of all quality issues
Tool Call:
{
"format": "detailed"
}
Example 3: Dashboard Integration
Prompt:
Export quality data for our monitoring dashboard
Tool Call:
{
"format": "json"
}
Report Sections
| Section | Summary | Detailed | JSON |
|---|---|---|---|
| Quality Gate | ✅ | ✅ | ✅ |
| Ratings | ✅ | ✅ | ✅ |
| Issue Counts | ✅ | ✅ | ✅ |
| Issue Details | ❌ | ✅ | ✅ |
| File Breakdown | ❌ | ✅ | ✅ |
| Trends | ✅ | ✅ | ✅ |
| Recommendations | ✅ | ✅ | ❌ |
Use Cases
| Scenario | Format | Reason |
|---|---|---|
| Daily standup | summary | Quick overview |
| Sprint review | summary | Stakeholder-friendly |
| Technical debt analysis | detailed | Full visibility |
| CI/CD pipeline | json | Automated processing |
| Management report | summary | High-level metrics |
| Issue triage | detailed | Prioritize fixes |
Best Practices
- Regular reporting - Generate weekly for trend tracking
- Match audience - Summary for stakeholders, detailed for developers
- Track trends - Compare reports over time
- Act on recommendations - Don't just generate, follow up
Common Issues
"No data available"
Cause: Project hasn't been scanned.
Solution: Run sonar_scan_project first.
"Report seems outdated"
Cause: Using cached analysis data.
Solution: Re-scan project for fresh data.
Related Tools
sonar_scan_project- Generate fresh datasonar_get_project_metrics- Specific metricssonar_get_technical_debt- Debt focussonar_get_quality_gate- Gate status