Docs
Refactor Percentage

Refactor Percentage

This is the percentage of code that was edited more than 3 weeks after merging. Refactoring is a common engineering practice and short-term increase in refactoring indicates the team is restructuring the code base.

Refactor-percentage

Computation of the metric

  1. Changes to the codebase over time, including code modifications and merges into the main codebase, are tracked.
  2. The time elapsed since a code change was merged into the main codebase is determined.
  3. If a code change is edited more than three weeks after merging, it is classified as a "refactor."
  4. The refactor percentage is calculated as the ratio of total lines of code refactored (edited more than three weeks after merging) to the total lines of code in the project, expressed as a percentage.

Dashboards where this metric is used

  1. Developer Summary
  2. Dev Metric Grid
  3. Dev Throughput

Use cases of the metric

  1. Evaluate the ongoing maintenance and improvement efforts by monitoring the percentage of code refactored, indicating the level of attention to code quality and technical debt reduction.
  2. Detect potential technical risks and areas of code complexity by analyzing patterns in refactoring activities, helping teams proactively address potential issues before they escalate into larger problems.
  3. Inform decision-making processes by assessing the need for resource allocation towards refactoring activities, ensuring a balanced approach to feature development and codebase maintenance.