Code Quality Metrics | Coverage, Complexity & Debt
Track code coverage, cyclomatic complexity, duplication, and tech debt ratio. GitScrum integrates with GitHub, GitLab, and SonarQube for quality-aware planning.
6 min read
Code quality directly impacts development velocity, bug rates, and team morale. Tracking quality metrics helps teams identify problem areas before they become critical. GitScrum integrates with development tools to make quality visible alongside project progress.
Code Quality Dimensions
| Dimension | Metrics | Impact |
|---|---|---|
| Reliability | Bug density, MTTR | User experience |
| Maintainability | Complexity, duplication | Development velocity |
| Security | Vulnerabilities, OWASP | Risk exposure |
| Performance | Load time, efficiency | User satisfaction |
| Testability | Coverage, test quality | Confidence to change |
Key Metrics Framework
Core Metrics
CODE QUALITY METRICS
ββββββββββββββββββββ
COVERAGE METRICS:
βββ Line coverage: % lines tested
βββ Branch coverage: % branches tested
βββ Function coverage: % functions tested
βββ Target: 70-80% (context-dependent)
COMPLEXITY METRICS:
βββ Cyclomatic complexity per function
βββ Cognitive complexity
βββ Lines per file/function
βββ Nesting depth
DUPLICATION METRICS:
βββ Duplicated lines %
βββ Duplicated blocks
βββ Copy-paste detection
βββ Target: <5% duplication
TECHNICAL DEBT:
βββ Debt ratio (debt/dev time)
βββ Debt in hours/days
βββ Debt per component
βββ Trend over time
Review Metrics
CODE REVIEW METRICS
βββββββββββββββββββ
SPEED:
βββ Time to first review
βββ Time to merge
βββ Review cycles
βββ PR age distribution
QUALITY:
βββ Comments per PR
βββ Approval rate
βββ Rework requests
βββ Review depth
PARTICIPATION:
βββ Reviews per person
βββ Review distribution
βββ Reviewer workload
βββ Knowledge spread
TARGETS:
βββ First review: <4 hours
βββ Time to merge: <24 hours
βββ Review cycles: <2
βββ All team members reviewing
GitScrum Quality Dashboard
Integrated View
QUALITY DASHBOARD LAYOUT
ββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββ
β Code Quality Overview β
β Last updated: 5 min ago β
βββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β HEALTH SCORE β
β βββββββββββββββββββββ 78/100 (β 3 pts) β
β β
ββββββββββββββ¬βββββββββββββ¬βββββββββββββ¬βββββββββββ€
β Coverage β Complexity β Duplicationβ Debt β
β 72% β β 12 β β 3.2% = β 4.2d β β
β Target:70%β Target:<15β Target:<5% β β
ββββββββββββββ΄βββββββββββββ΄βββββββββββββ΄βββββββββββ
β β
β TREND (Last 30 Days) β
β β
β Coverage: βββββββββββββββββββββ² β
β Debt: βββββββββΌββββββββββββββ β
β Bugs: ββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
Quality by Component
COMPONENT QUALITY TABLE
βββββββββββββββββββββββ
Component β Coverage β Complexity β Debt β Status
βββββββββββββββββββΌβββββββββββΌβββββββββββββΌβββββββββΌββββββββ
api/auth β 85% β 8 β 0.5d β β Good
api/payments β 72% β 14 β 1.2d β β Watch
api/users β 68% β 11 β 0.8d β β Good
frontend/core β 45% β 22 β 2.1d β β Action
frontend/common β 78% β 9 β 0.4d β β Good
βββββββββββββββββββ΄βββββββββββ΄βββββββββββββ΄βββββββββ΄ββββββββ
ATTENTION NEEDED:
βββ frontend/core: Low coverage, high complexity
βββ api/payments: Complexity trending up
Quality-Aware Planning
Sprint Quality Goals
SPRINT QUALITY GOALS
ββββββββββββββββββββ
SPRINT 15 QUALITY TARGETS:
βββ Maintain coverage above 70%
βββ Reduce api/payments complexity by 2 points
βββ Address 3 critical code smells
βββ Zero security vulnerabilities
QUALITY TASKS:
βββ [TECH] Refactor PaymentProcessor class
β Estimate: 4h
β Impact: -3 complexity
β
βββ [TECH] Add tests for AuthService
β Estimate: 6h
β Impact: +8% coverage
β
βββ [TECH] Fix code duplication in validators
Estimate: 2h
Impact: -1.5% duplication
SPRINT CAPACITY ALLOCATION:
βββ Features: 70%
βββ Bugs: 15%
βββ Technical debt: 15%
Quality Gates
QUALITY GATES FOR MERGE
βββββββββββββββββββββββ
AUTOMATED CHECKS:
βββ β Coverage β₯ existing coverage
βββ β No new critical issues
βββ β No new security vulnerabilities
βββ β No new code duplication
βββ β Complexity within limits
βββ β All tests passing
ENFORCEMENT:
βββ Block merge if gate fails
βββ Require manual override for exceptions
βββ Track overrides for review
βββ Trend monitoring for regressions
Tool Integrations
SonarQube Integration
SONARQUBE + GITSCRUM
ββββββββββββββββββββ
SYNC CONFIGURATION:
βββ Project key mapping
βββ Webhook for updates
βββ Issue sync (optional)
βββ Dashboard embedding
VISIBLE METRICS:
βββ Quality gate status
βββ New code metrics
βββ Overall health
βββ Issue breakdown
WORKFLOW:
1. Developer pushes code
2. CI runs SonarQube analysis
3. Results sync to GitScrum
4. Quality visible on task
5. Gate blocks if failed
GitHub Integration
GITHUB METRICS SYNC
βββββββββββββββββββ
PR METRICS:
βββ Time to first review
βββ Review cycles
βββ Comments count
βββ Merge time
βββ CI status
LINKED DATA:
βββ PR linked to GitScrum task
βββ Commits visible on task
βββ Build status shown
βββ Review status synced
βββ Auto-close on merge
Quality Improvement Workflow
Debt Reduction Process
TECHNICAL DEBT PROCESS
ββββββββββββββββββββββ
IDENTIFY:
βββ Regular code analysis
βββ Team pain points
βββ Hotspot analysis
βββ Metric thresholds
PRIORITIZE:
βββ Business impact
βββ Developer impact
βββ Fix effort
βββ Risk if ignored
SCHEDULE:
βββ 15% sprint allocation
βββ Dedicated refactor sprints
βββ Boy scout rule (leave better)
βββ Never trade velocity for debt
TRACK:
βββ Debt items in backlog
βββ Trend over time
βββ Reduction velocity
βββ Celebrate improvements
Best Practices
For Quality Metrics
Anti-Patterns
QUALITY METRIC MISTAKES:
β Tracking too many metrics
β Focusing only on coverage
β Gaming metrics (tests without assertions)
β Ignoring quality for features
β Blaming individuals for metrics
β No action on insights
β Metrics without context