Note: These metrics and calculations apply to Flow Enterprise Server versions 2022.1.2 and earlier. Updated Coding 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 Active 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.