Lines of Code
Last updated: October 29, 2026
Lines of Code measures how many lines your contributors changed in merged pull requests (PRs) during the selected date range, after ignored files. It shows the volume of change, not the size of your codebase and not the value of the work.
Why it matters
Change activity: shows how much code your teams are changing over time and where.
Work patterns: comparing lines added with lines removed separates new development from cleanup and refactoring.
Context for other metrics: lines of code divided by Total PRs Merged gives an average PR size; paired with PR cycle time, it shows whether large changes slow review.
Never use Lines of Code alone to judge productivity or performance. 100 lines of complex logic and 100 lines of boilerplate count the same.
How it works
For each file in a PR, your version control system reports lines added, lines removed, and lines modified. A modified line is a removed line paired with the added line that replaced it. Span counts a modified line once.
Metric | Calculation per PR |
|---|---|
Lines of code | added + removed + modified |
Lines of code (added) | added + modified |
Lines of code (removed) | removed + modified |
Span reads each PR's per-file counts from the PR's latest diff.
Span subtracts files that match your ignored file patterns.
Span sums each PR, then sums all qualifying PRs whose merge time falls in the period.
What counts: merged and reverted PRs by people marked Contributor, in repositories and branches you haven't ignored. Test files count unless they match an ignore pattern. AI-assisted code counts like any other code; AI-specific reports track it separately.
What doesn't count: open, draft, and closed-without-merge PRs; commits pushed straight to a branch without a PR; files matching your ignore patterns; PRs from accounts Span can't map to a person, which covers most bots.
Where to find it: Insights > Productivity > Velocity > Delivery, once an admin turns the metric on. The breakdown table adds the added and removed columns. It's also available in team and person Metrics tabs, custom reports, and custom dashboards, with breakdowns by person, team, job level, job title, and repository.
Setup
Connect your version control system: GitHub, GitHub Enterprise Server, GitLab, or Azure DevOps. Bitbucket Cloud is also supported; Span turns it on for your organization on request.
An admin turns on Lines of Code Metric under Settings > Metrics. It's off by default because line counts are easy to misread as productivity.
Under Settings > Metrics > PR Lines of Code Metrics: Ignore Files, add gitignore-style patterns for files that shouldn't count, such as
package-lock.json,**/generated/**, vendored code, build output, and test snapshots. Span can also add a built-in list of common generated-file patterns for your organization on request.Check a few PRs against your version control system to confirm the counts look right, and adjust patterns if needed.
Things to know
A line edited in place counts once in the total. Worked example: a PR adds 40 new lines, deletes 10, and edits 50 in place. GitHub shows +90 −60. Span shows Lines of code (added) 90, Lines of code (removed) 60, and Lines of code 100. The added and removed variants match GitHub; the total is lower than added + removed by the number of modified lines.
Span's total runs below GitHub's. Besides counting edits once, Span drops ignored files, unmerged PRs, ignored repositories and usernames, and unmapped accounts.
Very large PRs: a PR that touches more than 1,000 files has no diff in Span and adds 0 lines.
Reverted PRs still count, unlike Total PRs Merged, which drops them.
Spikes are often generated code. If a period jumps, check whether lockfiles or generated clients slipped past your ignore patterns.
Added versus removed tells a story. High added with low removed usually means new features. High removed with low added usually means cleanup. Both high often means a rewrite.
Related articles
Need help?
Contact your Span account team or reach out to support@span.app.