New Code Metric
Definition. The New Code Metric is the percentage of code in a PR that is new (not modified or deleted). Why is This Metric Useful? Highlights the proportion of work dedicated to creating new functio…
Updated
by Steven Silverstone
Definition
The New Code Metric is the percentage of code in a PR that is new (not modified or deleted).
Why is This Metric Useful?
- Highlights the proportion of work dedicated to creating new functionality.

How to Use it?
- Balance efforts between new code, refactoring, and rework.

Examples for Context
- Teams focusing on new code saw increased feature delivery rates.

Data Sources
- Repository diff data.

Calculation
- (Lines added / Total lines changed) * 100.

Tunable Configurations
- Thresholds for line counts to exclude trivial changes.

Benchmarking Guidance
- New code typically constitutes 60-80% of PR changes for feature teams.

Error Margins and Limitations
- May overestimate impact if trivial lines are added.

Stakeholder Use Cases
- Developers: Monitor time spent on innovation.
- Managers: Ensure a balance between innovation and maintenance.
How did we do?
Merged Frequency Metric
PR Maturity Metric