Lines of Code

Lines of Code or LoC

Total Lines of Code (LOC) changed and is the sum of LOC added and LOC deleted in the selected time period. This number is computed for each active user by aggregating the diff LOC across all their PRs. For users with no PRs this metric will be zero.


Computation of the metric

  1. The codebase is analysed (VCS diffs) to find the total numbers of lines added within the chosen timeframe.
  2. The same process is then used to determine the number of lines deleted within the chosen timeframe as well.
  3. Both the values are added to give LOC. (LOC added + LOC deleted)

Dashboards where this metric is used

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

Use cases of this metric

  1. By tracking the total lines of code changed by individual developers or teams over time, managers can gain insights into productivity levels.
  2. Code review processes can benefit from using LOC changed as a metric to assess the impact of code changes. Reviewers can prioritize their efforts by focusing on changes with a significant number of lines of code added or deleted. This helps streamline the review process and ensure that critical changes receive appropriate attention.
  3. Monitoring the total lines of code changed can help identify problematic areas within the codebase.
  4. Measuring LOC as the only/key metric is fraught with risk and will encourage bad behaviour.
  5. Monitoring the total lines of code changed can help identify what kind of code change the team is doing within a given sprint / time period
  6. The code churn computation relies on LOC diffs & identity code change patterns over a period of time