**Note:** These metrics and calculations apply to Flow Enterprise Server versions 2022.1.2 and earlier. Updated code fundamentals metrics are available in Flow cloud and on Flow Enterprise Server versions 2022.2.1 and newer.

In this article

## What is an included commit?

Code fundamentals uses commits to calculate its metrics but not all commits are included in calculations.

Included commits are:

- Commits that are not by an author who is excluded from reports
- Commits by someone who is a contributor on a team if you're looking at team reports
- Commits that are not excluded by outlier detection
- Commits that are not a merge commit
- Commits that are not orphaned, such as those in a deleted branch

Code fundamentals uses the commit author's local time to calculate metrics.

## Churn and efficiency

Churn is code which is deleted or rewritten shortly after being written. Read more about how to calculate churn.

**Formula**:

Churn % = 100*(churn HALOC/total HALOC)

Churn HALOC is the number of lines of code that were churned. Total HALOC is the total lines of code.

Efficiency is the percentage of code that stays in the code base compared to churn. It is rounded up to the nearest percentage.

**Formula**:

Efficiency % = 100 - Churn % = 100*(1-(churn HALOC)/(total HALOC))

You can calculate efficiency for individuals or teams.

For team or organization calculations, first calculate the efficiency for each developer on the team. Then average the efficiency across all developers on the team to see the weekly team efficiency. To see monthly team efficiency, average the weekly team efficiencies for the month to create the overall number.

**Note:** When calculating the average across developers for a week, any developers with no efficiency for that week are excluded.

## Commits per active day

Commits per active day is the average of included commits a developer submitted on days they committed.

**Formula:**

Commits per active day = sum(included commits)/sum(active days)

You can calculate commits per active day for individuals or teams.

For organization and team calculations, the team commits per active day is the average of the commits per active day for each member of the team. To see monthly averages for commits per active day, average the weekly team commits per active day to see the overall number.

**Note:** When calculating the average across developers for a week, any developers with no commits for that week are excluded.

## Active days per week

An active day is any day where a developer commits code.

**Formula:**

Active days per week = sum(active days)/sum(total weeks)

Total weeks is the total number of weeks in a period irrespective of start date. It is calculated as the number of total days divided by seven.

For organization and team calculations, to calculate active days, first find the active days for each developer for each week. Then average the active days for each developer for each week. This gives you your weekly team average. To calculate the monthly team average, average all weekly team averages across the month.

**Note:** When finding the weekly average, any developer with zero coding days for that week is not included.

## Impact

Impact is the severity of edits to the codebase, as compared to the repository history.

**Formula:**

Impact per week = sum(impact)/(total weeks)

Total weeks is the total number of weeks in the period minus days during weeks where no code was committed.

Individual impact is the sum of the impact the developer had during the period.

For team and organization calculations, average the weekly impact across all developers to find the weekly team impact. Then average across the weekly team impacts to find monthly team impact.

**Note:** When finding the weekly average, any developer with no impact for the week is not included.

## How are team averages calculated?

Let's take a deeper look at how these formulas work for team calculations using an example.

This example looks at impact.

**Impact formula:**

Impact per week = sum(impact)/(total weeks)

In the example, there are two engineers on a team. One engineer has an impact of 100 on a particular week. The other engineer has an impact of 50 on that same week. The following week, the first engineer takes some time off and has an impact of 0. The second engineer has an impact of 80.

Here's how Flow calculates the average weekly impact for that team.

- Find the average impact on the team for the first week. That would be (100+50)/2 = 75.
- Find the average impact for the second week. Since the first engineer had no impact since he was on vacation, the average impact is the impact of the second engineer, which is 80.
- Calculate average impact for the week by averaging the impact for the two weeks in the period. That is (75+80)/2 = 77.5.