Skip to content

Integrations

Code size

How Trace measures the billable lines of code in your connected repositories, and how to estimate or reproduce the number yourself.

Trace measures the size of the code it covers so you can see it the same way we do. The number that matters is billable lines of code: first-party application code that contains something other than whitespace or a comment. We don't count tests, documentation, configuration and data files, or vendored and generated code.

You'll find the measurement in the Code size section of the Source code page in your dashboard (Settings, then Source code). It covers the connected repositories and uploaded code snapshots Trace scans, whichever platform they live on. Repositories you've excluded from scanning don't count, and the total updates as soon as you include or exclude one. A repository archived on GitHub is excluded when it's archived and stays in your repository list with an Archived mark; include it again if you still want it scanned and counted.

The Code size section of the Source code page in the Trace dashboard: 159,820 billable lines of code out of 317,960 total lines across 3 connected repositories, with a breakdown into billable code, blank and comment lines, tests, documentation, configuration and data, and vendored and generated code.
The Code size section of the Source code page in the Trace dashboard: 159,820 billable lines of code out of 317,960 total lines across 3 connected repositories, with a breakdown into billable code, blank and comment lines, tests, documentation, configuration and data, and vendored and generated code.

What gets counted

Every file in a repository lands in exactly one bucket. The first matching rule wins:

  1. Vendored & generated: vendor and codegen directories, lockfiles, minified assets, files with generated-code markers ("do not edit" headers and the like), and third-party libraries copied into your repository.
  2. Tests: test, spec, e2e, fixture, mock, and snapshot directories, plus test filename conventions (*.test.ts, *_test.go, *Test.java, test_*.py, and friends).
  3. Documentation: Markdown, MDX, RST, AsciiDoc, plain text.
  4. Configuration & data: JSON, YAML, TOML, XML, INI, CSV, SVG, Terraform, Dockerfiles, Makefiles, CI config, schema definitions, and HTML files with 5,000 or more lines of code (not counting blanks and comments), which are usually saved pages, reports, or generated sites.
  5. Billable code: everything else. This is the code Trace actually tests for vulnerabilities.

Billable lines of code is the count of non-blank, non-comment lines in that last bucket.

Which code is measured

Each repository is measured from a fresh clone of its scanning branch (or its default branch if you haven't configured one). That's the same tree Trace scans. Only line counts are stored; the clone is deleted as soon as counting finishes.

Uploaded code is measured from the snapshot you uploaded, once it has passed the malware and archive checks. The archive is extracted with the same safety rules a pentest session uses, counted, and deleted from the measuring machine. Application builds (APK and IPA files) aren't measured: there's no source in them to count.

A repository with no commits counts as 0 and shows No commits in the list. Once you push code to it, select Recalculate to count it.

Measurement happens automatically: when you connect a repository, when your installation syncs, when a repository's scanning branch changes, when you include a repository in scanning again, and when an uploaded snapshot becomes ready. There's nothing to run or maintain.

To pick up recent pushes, an admin or manager can select Recalculate in the Code size section. Trace measures anything that hasn't been counted yet, re-measures repositories whose branch has moved since their last count, and leaves the rest as they are. Each organization can recalculate up to 10 times in any 24 hours.

Estimating before you connect

You can get this number without giving Trace access to anything. tracecli code-size estimate counts a checkout on your own machine with the same counter and the same rules as the dashboard. You don't need a Trace account, and the command doesn't use the network, so your source code never leaves your machine.

npm install -g securewithtrace
brew install scc

cd /path/to/your/repo
tracecli code-size estimate

The CLI runs on Bun; installing the CLI covers that.

In a git checkout it counts tracked files only, the way a fresh clone looks, so installed dependencies and build output don't inflate the result. Check out the branch you want Trace to scan first. To size a whole organization, pass each repository's checkout (tracecli code-size estimate ~/src/*/) and the command totals them. The CLI reference has the options and the output formats.

Reproducing the number

The dashboard breaks the measurement down so it reconciles against tools you can run yourself. The underlying counter is the open-source scc, run with ignore files disabled so the count covers every tracked file. Use the same flags:

cd /path/to/your/repo
scc --no-gitignore --no-ignore --no-scc-ignore .

scc's total line count matches the Total lines figure in the dashboard's "What's counted" table. (A bare scc run can come out lower: by default it skips files matched by .gitignore, .ignore, or .sccignore, including tracked files.) Your billable count is the subset of those lines that are non-blank, non-comment lines of files in the billable-code bucket. The table shows exactly how the rest of the total splits across blanks and comments, tests, documentation, configuration, and vendored code. tracecli code-size estimate applies the same per-file classification to a local checkout, so it gives you the billable count and the split directly.