GitVoyant tracks multiple complexity metrics over time to build a comprehensive picture of code evolution.
Definition: Number of linearly independent paths through code
Calculation:
Complexity = 1 + number_of_decision_points
Decision Points:
if,elif,elsewhile,forloopstry,exceptblocks- Boolean operators (
and,or) - Ternary operators
Interpretation:
- 1-10: Simple, easy to test
- 11-20: Moderate complexity
- 21-50: High complexity, consider refactoring
- 50+: Very high risk, immediate attention needed
Definition: Total number of non-empty lines
Significance:
- Correlates with maintenance effort
- Growth rate indicates development velocity
- Sudden spikes suggest rushed development
Definition: Number of function definitions
Usage:
- Tracks code organization patterns
- Helps identify monolithic growth
- Correlates with modularity
Definition: Number of class definitions
Purpose:
- Measures architectural complexity
- Tracks object-oriented design evolution
- Identifies abstraction patterns
Definition: Rate of complexity change per time unit
Calculation:
slope = linear_regression(time_points, complexity_values)Interpretation:
- Positive slope: Increasing complexity (risk)
- Negative slope: Decreasing complexity (refactoring)
- Zero slope: Stable complexity (ideal)
Definition: Standard deviation of complexity changes
Purpose:
- Measures consistency of development
- High volatility indicates unstable development
- Low volatility suggests controlled evolution
Definition: Percentage change in complexity over time
Formula:
growth_rate = (current_complexity - initial_complexity) / initial_complexity
Definition: Rate of change in complexity growth
Significance:
- Detects when complexity growth is accelerating
- Early warning of decay patterns
- Predicts maintenance crisis points
Definition: How complexity correlates with number of contributors
Evaluation:
- More authors often correlates with complexity growth
- Measures coordination overhead
- Identifies files needing better documentation
Definition: Number of commits per time period
Correlation:
- High frequency + complexity growth = high risk
- High frequency + stable complexity = healthy iteration
- Low frequency + complexity growth = technical debt accumulation
GitVoyant combines metrics into a unified risk rank:
risk_score = (
0.4 * normalized_complexity_tenor +
0.3 * normalized_volatility +
0.2 * normalized_growth_rate +
0.1 * modification_frequency_factor
)- 0.0 - 0.3: Low Risk(Green)
- 0.3 - 0.7: Medium Risk (Yellow)
- 0.7 - 1.0: High Risk (Red)
Metrics are being validated against open source projects (alpha research)
- Known refactoring events in open source projects
- Bug introduction patterns
- Developer reported maintenance pain points
- Code review feedback correlations
- New files: Minimum 5 commits required
- Refactoring events: Detected and handled separately
- Syntax errors: Graceful degradation to line-based metrics
- Binary files: Automatically excluded
- Incremental evaluation: Only evaluate new commits
- Caching: Store computed metrics to avoid recomputation
- Sampling: For very large repositories, sample commit history
Planned additions:
- Semantic complexity: Understanding code meaning, not just structure
- Test coverage correlation: How testing affects complexity evolution
- Documentation density: Comments and docstring evaluation
- API surface complexity: Public interface evolution tracking
🔮 GitVoyant by Jesse Moses (@Cre4T3Tiv3) at ByteStack Labs