Skip to content

Track Time-Saved with Code Churn & Complexity Metrics #143

@srtab

Description

@srtab

Description

DAIV should track and collect key metrics from merge requests (MRs) that it has implemented to estimate the time saved for each task. By gathering code churn (added, modified, and deleted lines) and code complexity (using established complexity metrics like cyclomatic complexity or maintainability index), DAIV can calculate a heuristic for "time saved." This data would help quantify DAIV’s value, demonstrate ROI, and provide insight into developer productivity.

User Story

As a project manager, I want to track code churn and complexity metrics from MRs completed by DAIV so that I can estimate the time saved and quantify DAIV's impact on developer efficiency.

Benefits

  • Quantifiable ROI: Demonstrate the value of DAIV to stakeholders.
  • User Motivation: Drive further adoption of DAIV by showing users their time savings.
  • Continuous Improvement: Identify gaps in DAIV's automation capabilities for more effective automation.

Use Cases

  • Case 1: A developer tracks how much time DAIV saved them on a merge request that involved 100+ lines of code changes.
  • Case 2: A project manager generates a report for stakeholders that shows total time saved by DAIV over the past month.
  • Case 3: A team lead assesses if DAIV is providing enough value to justify continued use and renewal.

Additional Notes

Performance

  • Calculating code churn and complexity metrics may introduce latency, especially for large MRs. Use background processing (e.g., Celery) to offload calculations.

Security

  • Ensure that sensitive information is not exposed. Only show abstracted statistics (like line counts and complexity scores) to protect code privacy.

Possible Heuristic

A possible heuristic for calculating time saved could be:

Time Saved = (Churn Factor * Complexity Factor) * Baseline Developer Time Per Line

Where:

  • Churn Factor: A coefficient calculated from the number of added, modified, and deleted lines.
  • Complexity Factor: A score from 1 to 3 based on the cyclomatic complexity of the MR.
  • Baseline Time: The average time a developer takes to modify a line of code (e.g., 2-5 minutes per line).

Dependencies

  • MR Data: Build on existing MR tracking in DAIV.
  • Code Analysis Tools: Use libraries like Radon for cyclomatic complexity analysis.
  • Background Processing: Offload calculations to background workers (like Celery).

Long-Term Goals Alignment

This feature aligns with DAIV’s long-term goal of quantifying developer efficiency, driving user adoption, and providing actionable insights for improvement. It also introduces the potential for additional analytics, dashboards, and impact reports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions