Skip to content

05_17_07: History Analysis - AudioLab Git Insights

Executive Summary

Comprehensive git history analysis providing insights into development patterns, team productivity, code quality trends, and technical health metrics.

Key Features: - Complete commit history analysis - Author contribution tracking - File hotspot detection - Bus factor calculation - Real-time metrics dashboard - Velocity trend analysis - Quality scoring


Tools

history_analyzer.py

Analyzes complete git history for comprehensive insights.

Usage:

# Full analysis report
python history_analyzer.py analyze

# Top contributors
python history_analyzer.py contributors --limit 10

# Hotspot files (frequently changed)
python history_analyzer.py hotspots --limit 10

# Bus factor analysis
python history_analyzer.py bus-factor

# Time-filtered analysis
python history_analyzer.py analyze --since "3 months ago"
python history_analyzer.py analyze --since "2024-01-01" --until "2024-06-30"

# JSON output
python history_analyzer.py analyze --format json

Example Output:

============================================================
AudioLab Git History Analysis Report
============================================================

## Overview
Total Commits:     1,247
Contributors:      8
Files Touched:     342
Date Range:        2024-01-15 to 2025-01-15 (365 days)

## Code Changes
Lines Added:       45,231
Lines Removed:     12,459
Total Changes:     57,690

## Commit Quality
Conventional:      1,089 (87.3%)
Avg Quality Score: 78.5/100

## Velocity
Commits/Day:       3.4
Commits/Week:      23.9
Commits/Author:    155.9

## Top 10 Contributors
 1. Alice Smith              423 commits   28,459 lines
 2. Bob Johnson              287 commits   15,234 lines
 3. Carol Davis              198 commits    8,912 lines
...

## Bus Factor Analysis
Bus Factor:        3
Risk Level:        MODERATE
Top Contributor:   Alice Smith (33.9%)
Explanation:       3 person(s) account for 50% of commits


commit_metrics.py

Real-time metrics tracking and dashboard generation.

Usage:

# Live dashboard
python commit_metrics.py dashboard

# Today's metrics
python commit_metrics.py today

# This week
python commit_metrics.py week

# This month
python commit_metrics.py month

# Commit quality
python commit_metrics.py quality

# Velocity trend
python commit_metrics.py velocity

# Export all metrics as JSON
python commit_metrics.py export > metrics.json

Dashboard Example:

======================================================================
                    AudioLab Commit Metrics Dashboard
======================================================================

📊 TODAY
  Commits:       5
  Authors:       3
  Files:         12
  Lines changed: 247

📈 THIS WEEK
  Commits:       34
  Authors:       5
  Files:         68
  Lines changed: 1,823

📅 THIS MONTH
  Commits:       142
  Authors:       8
  Files:         234
  Lines changed: 8,459

✨ COMMIT QUALITY (Last Month)
  Total commits:      142
  Conventional:       124 (87.3%)
  Avg message length: 58 chars

🏷️  COMMIT TYPES (Last Month)
  feat        52 ██████████████████████████
  fix         38 ███████████████████
  refactor    21 ██████████
  test        15 ███████
  docs        12 ██████
  chore        4 ██

🌿 BRANCHES
  Total:   23
  Active:  15
  Stale:   8

📉 VELOCITY TREND (Last 4 Weeks)
  Week -4:  28 ████████████████████████
  Week -3:  35 ██████████████████████████████
  Week -2:  42 ████████████████████████████████████
  Week -1:  37 ███████████████████████████████

======================================================================
Generated: 2025-01-15 14:23:45
======================================================================


Key Metrics

Commit Analysis

  • Frequency: Commits per day/week/month
  • Quality Score: 0-100 based on message format, length, conventional commits
  • Size: Lines changed per commit
  • Timing: When commits are made (working hours vs evening/night)

Author Analysis

  • Contribution Rate: Commits per author
  • Specialization: File areas per author
  • Collaboration: Co-authorship patterns
  • Velocity: Productivity over time

File Analysis

  • Churn Rate: How often files change
  • Hotspots: Most frequently changed files
  • Ownership: Primary maintainer per file
  • Age: Time since last modification

Bus Factor

  • Definition: Number of people who need to disappear for project to stall
  • Calculation: Minimum contributors accounting for 50% of commits
  • Risk Levels:
  • Critical: Bus factor = 1
  • High: Bus factor ≤ 2
  • Moderate: Bus factor ≤ 5
  • Low: Bus factor > 5

Insights

Refactoring Candidates

Files with high churn + large size + many authors = refactoring needed

python history_analyzer.py hotspots

Knowledge Gaps

Files with single contributor or no recent commits = knowledge concentration risk

Productivity Patterns

  • Night/weekend commits may indicate deadline pressure
  • Irregular velocity may indicate blockers
  • Declining quality score may indicate rushed work

Configuration Files

history_analysis.yaml

Complete configuration (~15 KB): - Analysis types definitions - Time-based analysis windows - Trend analysis formulas - Code health metrics - Report templates


Integration

CI/CD

# .github/workflows/metrics.yml
- name: Generate daily metrics
  run: python commit_metrics.py export > metrics/daily-$(date +%Y-%m-%d).json

- name: Post dashboard to Slack
  run: |
    python commit_metrics.py dashboard > dashboard.txt
    # Post to Slack webhook

Daily Dashboard

# Add to cron:
0 9 * * * cd /path/to/repo && python commit_metrics.py dashboard | mail -s "Daily Metrics" team@company.com

Best Practices

  1. Track metrics regularly - Daily dashboard review
  2. Monitor bus factor - Mitigate knowledge concentration
  3. Watch velocity trends - Identify blockers early
  4. Maintain quality score - Target >80% conventional commits
  5. Address hotspots - Refactor high-churn files

Alerts

Bus factor critical (= 1):

Action: Immediate knowledge sharing initiative

Quality score declining:

Action: Review practices, provide training

Velocity down 20% over 2 weeks:

Action: Investigate blockers, reduce context switching


Part of AudioLab Version Control System (05_17_VERSION_CONTROL)