This page documents every command, option, exit code, report format, and configuration key of codeint.
See Feedback budget for the checks and warning reports used by codeint's own CI. GLOSSARY.md defines every term on this page. For calling codeint from JavaScript, TypeScript, Rust, or Dart, see docs/programmatic.md.
If GitHub returns HTTP 403 when the Action creates or updates a pull-request comment, the Action warns and continues.
The Action then enforces the analysis exit code according to fail-on-regression.
See the GitHub Actions guide for workflow setup and inputs.
Every example on this page runs in the same sample repository at /home/me/shop.
Branch main has two commits:
Add sign, on 2026-11-02, addssrc/sign.tswith a Flagged line,src/types.d.tswith type declarations only, andsrc/broken.ts, which does not parse.Add parse, on 2026-11-09, addssrc/parse.tswith an eroded function.
origin/main points to the same commit as main.
Branch feature starts at main and is checked out.
Its commit Simplify parse, on 2026-11-16, makes src/parse.ts simple and adds src/total.ts.
The working tree adds src/route.ts, an eroded function that is not committed.
It also holds a plugins folder with four Wasm Plugin files built from the test fixtures: sample_mini_plugin.wasm (a valid Language plugin that claims .mini files), sample_long_functions_plugin.wasm (a valid Metric plugin), out_of_range_ratio_metric_plugin.wasm (a Metric plugin that returns a ratio above 1), and legacy_v0_3_0_language_plugin.wasm (a Language plugin built against an older contract), plus plugins/sample.mini, a source file for the valid Language plugin.
| Command | Meaning |
|---|---|
check |
Measure the working tree and print the report; see codeint check |
diff |
Compare the working tree, or a head Git ref, with the merge-base of a base Git ref; see codeint diff |
trend |
Measure each commit of the main line and print each Metric over time; see codeint trend |
impact |
Compute the transitive reverse-dependency blast radius of one or more repository files; see codeint impact |
trace |
Find the shortest runtime import path between two files in the repository; see codeint trace |
init |
Write a starter codeint.jsonc, and with --adopt the initial Ratchet and Baseline; see codeint init |
update |
Update a standalone codeint binary in place from GitHub Releases; see codeint update |
mcp |
Run a local stdio Model Context Protocol (MCP) server exposing check, diff, trend, guard, impact, trace, churn, and coupling tools; see codeint mcp |
guard |
Show the architectural boundary zone, allowed and denied target zones, public_files constraints, allowed importers, and external-package rules for a file path; see codeint guard |
schema |
Print a machine-readable capability manifest of CLI commands, flags, built-in Metrics, output formats, MCP tools, and exit codes; see codeint schema |
config |
Inspect the effective active configuration and where each setting came from; see codeint config |
report |
Re-render a saved check or diff JSON report into another format or publish a GitHub Checks API check run without re-running analysis; see codeint report |
doctor |
Run read-only diagnostics on the configuration file, Git repository status, detected languages, Workspace packages, and external Wasm Plugins; see codeint doctor |
agent |
Inspect and configure codeint MCP integration for local coding agents; see codeint agent |
plugin |
Check an external Wasm Plugin against the codeint Plugin contract; see codeint plugin |
ratchet |
Manage the repository Ratchet ceilings in .codeint/ratchet.json; see codeint ratchet |
baseline |
Manage the repository Baseline of existing Findings in .codeint/baseline.json; see codeint baseline |
state |
Check repository Ratchet and Baseline state files against a base Git ref without weakening; see codeint state |
churn |
Rank eroded and duplicated files alongside their Git commit churn independently per Metric; see codeint churn |
coupling |
Detect pairs of files that repeatedly change together in the same commits and flag direct runtime imports; see codeint coupling |
help |
Print the help of codeint, or of the command that follows it |
| Option | Meaning |
|---|---|
-h, --help |
Print the help of codeint; every command also takes -h, --help and prints its own help |
-V, --version |
Print the version of codeint |
codeint --versioncodeint 0.10.5
codeint --help
codeint -h
codeint -V
codeint help
codeint help check| Option | Meaning |
|---|---|
--adopt |
Also enable per-file Regression checks, write a zero Budget for each Production and Test Metric that the Baseline records, suggest new-file Budgets, write .codeint/ratchet.json and .codeint/baseline.json from the current state, and print pull-request CI instructions |
--format <FORMAT> |
The configuration file format to write: jsonc (default, writes codeint.jsonc), json (strict comment-free codeint.json), toml (codeint.toml with #:schema), or yaml (codeint.yaml with # yaml-language-server: $schema=) |
-h, --help |
Print the help of codeint init |
codeint init writes a starter codeint.jsonc (or codeint.json, codeint.toml, or codeint.yaml with --format) at the root of the Git repository that contains the current folder:
codeint initWrote /home/me/shop/codeint.jsonc
The file links to the JSON schema of the running codeint version, so your editor completes and checks it.
It sets every key to its default, and lists under languages each top-level folder or file that a Language plugin measures:
{
"$schema": "https://raw.githubusercontent.com/avidianity/codeint/v0.10.5/schema/codeint.schema.json",
"source_sets": {
"production": [],
"test": [],
"generated": [],
"vendored": []
},
"budgets": {
"production": {
// "test_gap": 0.2
},
"test": {},
"generated": {},
"vendored": {}
},
"regression_limits": {},
"languages": [
{
"plugin": "typescript-javascript",
"include": [
"src"
],
"exclude": []
}
],
"coverage_reports": []
}Pass --format to choose jsonc (the default), json (strict comment-free JSON), toml, or yaml:
codeint init --format jsonccodeint init --format jsoncodeint init --format tomlcodeint init --format yamlWhen no file belongs to a Language plugin, the file leaves languages out, so every Language plugin measures the whole repository.
When a detected Language plugin declares Dialects (such as sql), codeint init adds a commented dialects.<language> hint to the starter file.
codeint init also adds a commented-out Import boundary starter block only when high-confidence signals exist:
when built-in Language plugins discover two or more Workspace packages, it suggests commented-out boundaries.zones entries for each Workspace package;
in a single-package repository whose Production source files match at least two zones of the layered or hexagonal preset, it suggests the matching commented-out boundaries.preset;
in a flat or custom layout without those signals, it emits no boundary suggestions.
Because the suggested block stays commented out, codeint check and codeint config pass cleanly immediately after codeint init.
codeint init --adopt onboards an existing codebase in one step (Adopting codeint on an existing codebase).
It writes the same starter codeint.jsonc with three differences: regression_limits.per_file is true, budgets.production and budgets.test hold a zero Budget for each Metric that the Baseline records, and a commented-out new_file_budgets block follows the last key.
It then measures the whole repository once, writes .codeint/ratchet.json as codeint ratchet update would on a first run, writes .codeint/baseline.json as codeint baseline update would on a first run, adds the zero Budgets to codeint.jsonc, and prints the next steps, including a pull-request workflow.
The zero Budgets cover the Production Metrics that the run measures without extra inputs (Erosion, Cognitive complexity, Duplication, Verbosity, Import cycles, Boundaries, Orphan files, and Hazards), the same Metrics except Orphan files under budgets.test, and the three Dependency hygiene Metrics under budgets.
A Metric that the run does not measure gets no Budget; Test gap gets none, because codeint never guesses Coverage reports, and its commented test_gap line stays.
Because the Baseline hides every existing Finding, codeint check compares each zero Budget with the non-baselined ratio, which is 0 on day one, so codeint check passes immediately afterward.
A new Finding of a recorded Metric makes the non-baselined ratio positive, so codeint check fails with exit code 1 and the non-baselined production erosion ratio 0.4714 is over its Budget 0.
That holds even when the same change tidies a legacy Finding, because the new Finding itself fails the Budget.
The Ratchet separately caps each whole-repository ratio, and it alone does not catch such a swap.
codeint init --adopt never replaces a file: it stops with exit code 2, before it writes anything, when a configuration file, .codeint/ratchet.json, or .codeint/baseline.json already exists.
When measuring or writing the state files fails, it removes the files it wrote and exits with code 2; when a removal fails too, the error names every path left behind.
Run codeint ratchet update or codeint baseline update instead to refresh an existing state file.
When a configuration file already exists, the message points to codeint ratchet update and codeint baseline update, which create the state files for it.
codeint init --adoptWrote /home/me/shop/codeint.jsonc
Wrote /home/me/shop/.codeint/ratchet.json (5 Metric ceilings)
Wrote /home/me/shop/.codeint/baseline.json (2 existing Findings)
Next steps:
1. Commit codeint.jsonc and the .codeint folder.
2. Run codeint check locally and in your coding agent loop; the Baseline hides the existing Findings, and the zero Budgets in codeint.jsonc (production, test, and dependency Metrics) fail on any new Finding of a Metric the Baseline records; the Ratchet separately caps each whole-repository ratio.
3. Save this as .github/workflows/codeint.yml to gate every pull request:
name: codeint
on:
pull_request:
permissions:
contents: read
pull-requests: write
jobs:
codeint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 0
- uses: avidianity/codeint@main
with:
version: v0.10.5
4. After you fix legacy code, run codeint ratchet update and codeint baseline update, and commit the result.
5. To hold every new file to a strict bar, uncomment new_file_budgets in codeint.jsonc.
Guide: https://github.com/avidianity/codeint/blob/main/docs/guide/adopting-on-an-existing-codebase.md
codeint init never replaces an existing configuration file at any of the ten supported paths.
With this codeint.json in place:
{}codeint init stops with exit code 2:
codeint initcodeint: /home/me/shop/codeint.json already exists, and codeint init never replaces it
Edit the existing codeint.json, or delete it and run codeint init again.
| Argument | Meaning |
|---|---|
[PATH] |
A folder inside the Git repository to measure; the current folder by default |
| Option | Meaning |
|---|---|
--package <PATH> |
Scope measurement and output to this Workspace package |
--output <FILE> |
Write the report to this file instead of standard output |
--all |
List every Finding instead of the 20 worst per Metric |
--format <FORMAT> |
The format of the report: toon, the default, text, json, sarif, or markdown; overrides format in the configuration file; see Report formats |
--owner <OWNER> |
Include only Findings whose CODEOWNERS owner matches this pattern |
--coverage-report <PATH> |
Path to an LCOV or Cobertura XML Coverage report; may repeat; when present, replaces coverage_reports from the configuration file; see Test gap |
--ignore-baseline |
Show every Finding and evaluate Budgets on every Finding, as if .codeint/baseline.json did not exist; see codeint baseline |
-h, --help |
Print the help of codeint check |
codeint check measures the working tree, including uncommitted and untracked files, and prints the report:
codeint checkfiles: 4
source_lines: 39
source_sets:
production:
files: 4
source_lines: 39
erosion:
ratio: 0.7986
metric_version: 2
reference_range:
low: 0.187
high: 0.671
source: "codeint stratified panel of 100 TypeScript and JavaScript repositories, ADR 0035, eval/panels.json, 2026-12-02, commit 9e3f53053618"
eroded_function_mass: 67.8823
total_function_mass: 85.0032
findings[1]{id,path,line,end_line,name,cyclomatic_complexity,cognitive_complexity,source_lines,function_mass}:
f0740d06c0975d68,src/route.ts,1,18,route,16,15,18,67.8823
cognitive_complexity:
ratio: 0
metric_version: 2
reference_range:
low: 0.121
high: 0.532
source: "codeint stratified panel of 100 TypeScript and JavaScript repositories, ADR 0035, eval/panels.json, 2026-12-02, commit 9e3f53053618"
complex_cognitive_complexity: 0
total_cognitive_complexity: 20
findings: []
duplication:
ratio: 0
metric_version: 3
reference_range:
low: 0.018
high: 0.252
source: "codeint stratified panel of 100 TypeScript and JavaScript repositories, ADR 0035, eval/panels.json, 2026-12-02, commit 9e3f53053618"
clone_lines: 0
clone_groups: []
verbosity:
ratio: 0.0256
metric_version: 4
reference_range:
low: 0
high: 0.002
source: "codeint stratified panel of 100 TypeScript and JavaScript repositories, ADR 0035, eval/panels.json, 2026-12-02, commit 9e3f53053618"
verbose_lines: 1
flagged_lines: 1
findings[1]{id,path,line,rule}:
2a57800b29941394,src/sign.ts,4,else-after-return
import_cycles:
ratio: 0
metric_version: 3
reference_range:
low: 0
high: 0.182
source: "codeint stratified panel of 100 TypeScript and JavaScript repositories, ADR 0035, eval/panels.json, 2026-12-03, commit 2887c2d69196"
modules_in_import_cycles: 0
modules: 4
findings: []
unresolved_imports:
count: 0
imports: []
test_gap_note: Test gap is not measured because no Coverage report was named.
skipped[1]{path,reason}:
src/broken.ts,"cannot parse: Unexpected token at line 1, column 23"
declaration_only[1]: src/types.d.ts
codeint measures the files that Git does not ignore.
It does not follow symbolic links, does not measure Git submodules, and skips files that are not valid UTF-8.
It lists each file it cannot parse under skipped, and each file that holds only type declarations under declaration_only.
When --coverage-report or coverage_reports names one or more Coverage reports, codeint check reports Test gap (test_gap) for the Production Source set, per language, and per Workspace package, with Findings ordered heaviest untested Function mass first, and prints one note naming any unmatched report paths.
When no Coverage report is named, or when no report covers a language, Test gap is absent (never 0 or 1) and the report states why in one line; see Test gap.
These commands measure the same repository with other options:
codeint check src
codeint check --all
codeint check --owner @team
codeint check --coverage-report coverage/lcov.info
codeint check --ignore-baseline
codeint check --format markdown --output report.mdA PATH that does not exist stops the run with exit code 2:
codeint check missingcodeint: missing does not exist
Pass a folder that exists, or leave the path out to measure the current folder.
Passing --package <PATH> in a repository without that Workspace package stops the run with exit code 2:
codeint check --package packages/missing| Argument | Meaning |
|---|---|
<BASE_REF> |
The base Git ref, such as main or origin/main; codeint measures its merge-base with the head |
| Option | Meaning |
|---|---|
--head <REF> |
Measure this Git ref from Git objects instead of the working tree; the merge-base is then taken with this ref instead of HEAD |
--rename-threshold <PERCENT> |
Minimum similarity percentage (0 to 100, default 50) to treat a deleted and added file pair as a rename; 0 disables rename detection |
--package <PATH> |
Scope measurement and output to this Workspace package |
--output <FILE> |
Write the report to this file instead of standard output |
--all |
List every Finding instead of the 20 worst per Metric |
--format <FORMAT> |
The format of the report: toon, the default, text, json, sarif, or markdown; overrides format in the configuration file |
--owner <OWNER> |
Include only Findings whose CODEOWNERS owner matches this pattern |
-h, --help |
Print the help of codeint diff |
codeint diff {base-ref} compares the working tree with the merge-base of the base ref and HEAD.
In the sample repository, the working tree adds the eroded function of src/route.ts, so the comparison finds a Regression and exits with code 1:
codeint diff mainbase:
ref: main
merge_base: 2ef203655bd71559d3e54d1ab60a2390fb90674c
head: working tree
source_sets:
production:
erosion:
base_ratio: 0.8946
head_ratio: 0.7986
metric_version: 2
new[1]{id,path,line,end_line,name,cyclomatic_complexity,cognitive_complexity,source_lines,function_mass}:
f0740d06c0975d68,src/route.ts,1,18,route,16,15,18,67.8823
resolved[1]{id,path,line,end_line,name,cyclomatic_complexity,cognitive_complexity,source_lines,function_mass}:
1b3d7d358ce8632e,src/parse.ts,1,14,parse,12,11,14,44.8999
unchanged: 0
cognitive_complexity:
base_ratio: 0
head_ratio: 0
metric_version: 2
new: []
resolved: []
unchanged: 0
duplication:
base_ratio: 0
head_ratio: 0
metric_version: 3
new: []
resolved: []
unchanged: 0
verbosity:
base_ratio: 0.0476
head_ratio: 0.0256
metric_version: 4
new: []
resolved: []
unchanged: 1
import_cycles:
base_ratio: 0
head_ratio: 0
metric_version: 3
new: []
resolved: []
unchanged: 0
regressions[1]{source_set,metric,rule,base,head,new_findings,ratio_rise_limit}:
production,erosion,numerator_rise,44.8999,67.8823,1,0.01
codeint: the production erosion numerator eroded_function_mass rose from 44.8999 to 67.8823
codeint reads the merge-base straight from Git objects, so it never checks out a commit and leaves the working tree and the index as they are.
The working tree side includes uncommitted and untracked changes, and leaves out the files that Git ignores, as codeint check does.
Commits added to the base branch after your branch started are not part of the comparison, because the merge-base comes before them.
Both sides use the configuration file of the working tree, so the comparison shows changes in the code, not in the configuration.
Both sides follow the same file rules as codeint check.
codeint diff measures Test gap only for the Production new-file Budget.
When a Coverage report is named, the report explains that Test gap is left out of the base and head comparison.
The report classifies each Finding by its id, surrounding-line context anchors, and detected file renames: new when only the head side has it, resolved when only the merge-base has it, and unchanged when both have it.
By default (--rename-threshold 50), codeint diff detects exact and similar file renames in process (for both the working tree and --head), keeps pre-existing Findings in renamed files classified as unchanged and hidden by .codeint/baseline.json, excludes rename destinations from new_file_budgets, and remaps per_file base numerators across renames.
Pass --rename-threshold 0 to disable rename detection, or a higher percentage up to 100 to require closer similarity; values above 100 fail with exit code 2.
For each Metric of each Source set, it shows the ratio on both sides, the new and the resolved Findings, worst first, and the number of unchanged Findings.
It lists at most 20 new and 20 resolved Findings per Metric, and counts the rest in new_left_out and resolved_left_out; --all lists every one.
--format text, --format json, and --format markdown print the same comparison.
--format sarif lists only the new Findings, so code scanning annotates what the change added.
codeint diff origin/main --all
codeint diff main --rename-threshold 50
codeint diff main --format text
codeint diff main --format json
codeint diff main --format markdown
codeint diff main --format sarif --output diff.sarifA base ref that names no commit stops the run with exit code 2 and names the ref:
codeint diff no-such-branchcodeint: the Git ref "no-such-branch" does not name a commit in this repository: couldn't parse revision, input="no-such-branch": Reference "no-such-branch" could not be found: NotFound
Pass a branch, tag, or commit that exists in this repository; fetch it first when it lives on a remote: git fetch origin main
Passing --package <PATH> for a Workspace package that does not exist stops the run with exit code 2:
codeint diff main --package packages/missing--head {ref} measures a second ref instead of the working tree, so you can compare two commits or two branches.
The commit of feature only makes src/parse.ts simpler, so this comparison passes:
codeint diff main --head featurebase:
ref: main
merge_base: 2ef203655bd71559d3e54d1ab60a2390fb90674c
head:
ref: feature
commit: e3bc223e22791aa541f8104438ce1606515231ce
source_sets:
production:
erosion:
base_ratio: 0.8946
head_ratio: 0
metric_version: 2
new: []
resolved[1]{id,path,line,end_line,name,cyclomatic_complexity,cognitive_complexity,source_lines,function_mass}:
1b3d7d358ce8632e,src/parse.ts,1,14,parse,12,11,14,44.8999
unchanged: 0
cognitive_complexity:
base_ratio: 0
head_ratio: 0
metric_version: 2
new: []
resolved: []
unchanged: 0
duplication:
base_ratio: 0
head_ratio: 0
metric_version: 3
new: []
resolved: []
unchanged: 0
verbosity:
base_ratio: 0.0476
head_ratio: 0.0476
metric_version: 4
new: []
resolved: []
unchanged: 1
import_cycles:
base_ratio: 0
head_ratio: 0
metric_version: 3
new: []
resolved: []
unchanged: 0
codeint reads the head ref from Git objects too, so neither the working tree nor HEAD takes part.
The merge-base is the merge-base of the base ref and the head ref.
Both sides still use the configuration file of the working tree, never the one in a commit.
So the classification matches running codeint check on a checkout of each side, when each checkout has that same configuration file.
A head ref that names no commit, or that shares no history with the base ref, stops the run with exit code 2:
codeint diff main --head no-such-branchcodeint: the Git ref "no-such-branch" does not name a commit in this repository: couldn't parse revision, input="no-such-branch": Reference "no-such-branch" could not be found: NotFound
Pass a branch, tag, or commit that exists in this repository; fetch it first when it lives on a remote: git fetch origin main
When a repository has a CODEOWNERS file (.github/CODEOWNERS, CODEOWNERS, or docs/CODEOWNERS), codeint attaches matched owners to Findings and --owner <OWNER> filters Findings to those matching the pattern:
codeint diff main --owner @teamA Regression is a Metric that got worse from the merge-base to the head side by more than its limit.
codeint diff checks each Metric of each Source set against three default rules:
- Any new Finding on Import cycles, Boundaries, Orphan files, Hazards, or Dependency hygiene is a Regression (
any_new_finding, plus numerator rise). - A ratio rise over 0.01 is a Regression. codeint compares the ratios as the report shows them, rounded to four decimal places, so a rise of exactly 0.01 passes when the numerator does not rise.
- Any numerator rise (rounded to four decimal places) is a Regression (
numerator_rise), even when no new Finding identifier appeared. The numerator iseroded_function_mass,complex_cognitive_complexity,clone_lines,verbose_lines,modules_in_import_cycles,boundary_findings,orphan_files,excess_lines,hazard_lines,unused,unlisted, ordev_in_production. A Finding that only moves to another file, so the numerator stays the same, is not a Regression undernumerator_rise. - When
regression_limits.per_fileistrue(falseby default),codeint diffalso compares file-level Metric numerators and Findings for every modified file. If any individual modified file worsens,codeint diffreports a per-file Regression naming that file, Metric, base value, and head value even when another file shrank enough to keep the repository total flat or lower.
regression_limits in the configuration file changes these limits.
codeint diff also applies the Budgets of the configuration file to the head side, as codeint check does.
When a Budget or a Regression fails, codeint still writes the whole report, lists each failure under over_budget or regressions, names it on standard error, and exits with code 1.
Each Regression names its rule and its base and head values: the ratios for ratio_rise and new_findings, the repository numerators for numerator_rise, and the file-level numerators alongside file for per_file_numerator_rise and per_file_new_findings.
In SARIF output, per-file Regressions also appear under runs[0].properties.perFileRegressions.
ratio_rise_limit is the ratio rise limit of the Metric in that Source set.
The output of codeint diff main above shows a Regression.
With no failure, the report has no over_budget or regressions key, and codeint exits with code 0.
| Option | Meaning |
|---|---|
--since <YYYY-MM-DD> |
Measure every main-line commit committed on or after this day, in UTC, instead of the latest 20 |
--commits <COUNT> |
Measure at most this many latest main-line commits from HEAD instead of the latest 20 |
--output <FILE> |
Write the report to this file instead of standard output |
--format <FORMAT> |
The format of the report: toon, the default, text, json, or markdown; overrides format in the configuration file |
-h, --help |
Print the help of codeint trend |
codeint trend measures each commit of the main line of the current branch and prints each Metric over time, oldest commit first:
codeint trendcommits: 3
metric_versions:
cognitive_complexity: 2
duplication: 3
erosion: 2
import_cycles: 3
verbosity: 4
source_sets:
production[3]{commit,committed_on,files,erosion,cognitive_complexity,duplication,verbosity,import_cycles}:
2864291867e0e3a3ef91cd050c1893d5ae9eb809,2026-11-02,1,0,0,0,0.1429,0
2ef203655bd71559d3e54d1ab60a2390fb90674c,2026-11-09,2,0.8946,0,0,0.0476,0
e3bc223e22791aa541f8104438ce1606515231ce,2026-11-16,3,0,0,0,0.0476,0
The main line is the first-parent history of HEAD: a merge commit is a row, and the commits of the branch it merged are not.
Without --since or --commits, codeint measures the latest 20 commits of the main line.
--commits <COUNT> measures at most <COUNT> latest main-line commits from HEAD (for counts below, equal to, or above 20):
codeint trend --commits 2Passing --commits 0 or combining --since and --commits stops the run with exit code 2.
--since {YYYY-MM-DD} measures every main-line commit committed on or after the start of that day in UTC, with no limit on the count:
codeint trend --since 2026-11-05commits: 2
metric_versions:
cognitive_complexity: 2
duplication: 3
erosion: 2
import_cycles: 3
verbosity: 4
source_sets:
production[2]{commit,committed_on,files,erosion,cognitive_complexity,duplication,verbosity,import_cycles}:
2ef203655bd71559d3e54d1ab60a2390fb90674c,2026-11-09,2,0.8946,0,0,0.0476,0
e3bc223e22791aa541f8104438ce1606515231ce,2026-11-16,3,0,0,0,0.0476,0
codeint compares the committer date, the date that git log --since uses, and scans up to 14 days earlier than that day before stopping so out-of-order commit timestamps do not truncate newer commits.
In a shallow clone, the trend stops at the oldest commit the clone has.
The report has one table per Source set, with one row per commit.
Each row shows the commit, the day it was committed in UTC, the number of measured files, and the ratio of each Metric.
A Source set appears only when at least one commit of the trend has a file in it.
--format text, --format json, and --format markdown print the same rows:
codeint trend --format text
codeint trend --format markdown
codeint trend --format json --output trend.jsonA trend lists no Findings, so it has no SARIF format; run codeint diff for the Findings of a change.
A trend applies no Budget and no Regression limit, and exits with code 0 when it measures every commit.
codeint trend computes Test gap for no commit; when a Coverage report is named, it prints one line stating that Test gap is left out because a Coverage report exists only for the code under measurement.
A day that is not a real day stops the run with exit code 2:
codeint trend --since 2026-02-30error: invalid value '2026-02-30' for '--since <YYYY-MM-DD>': "2026-02-30" is not a real day written as YYYY-MM-DD, such as 2026-01-31
For more information, try '--help'.
codeint reads each commit from Git objects, so it never checks out a commit and never touches the working tree; uncommitted changes are not part of a trend.
Every commit uses the configuration file of the working tree, as codeint diff does.
Each commit goes through the result cache, so a repeated trend measures only the commits that are new since the last run.
| Argument | Meaning |
|---|---|
[PATH]... |
Repository file paths to analyze |
| Option | Meaning |
|---|---|
--changed <BASE_REF> |
Analyze files changed since the merge-base of this Git ref and HEAD |
--depth <N> |
Maximum reverse-dependency hop distance to traverse |
--package <PATH> |
Scope reported dependents to this Workspace package |
--output <FILE> |
Write the report to this file instead of standard output |
--format <FORMAT> |
The format of the report: toon, the default, json, or text |
-h, --help |
Print the help of codeint impact |
codeint impact computes the transitive reverse-dependency blast radius of one or more repository files, distinguishing direct dependents (distance 1) from transitive dependents (distance 2 or more), separating Production dependents from Test dependents, and listing affected Workspace packages:
codeint impact src/sign.ts
codeint impact --changed main
codeint impact src/sign.ts --depth 1 --format text
codeint impact src/sign.ts --format toon
codeint impact src/sign.ts --format json --output impact.jsonPassing --package <PATH> for a Workspace package that does not exist stops the run with exit code 2:
codeint impact src/sign.ts --package packages/missingTypeScript and JavaScript trace paths follow the package export condition for each runtime import.
Static imports, re-exports, and import() match import.
Literal require() calls and TypeScript import assignments with require() match require.
| Argument | Meaning |
|---|---|
<FROM> |
Repository-relative path of the starting module |
<TO> |
Repository-relative path of the target module |
| Option | Meaning |
|---|---|
--all |
List all shortest runtime import paths up to --max-paths |
--max-paths <COUNT> |
Maximum number of shortest paths to list when --all is set |
--package <PATH> |
Scope the query to this Workspace package |
--output <FILE> |
Write the report to this file instead of standard output |
--format <FORMAT> |
The format of the report: toon, the default, json, or text |
-h, --help |
Print the help of codeint trace |
codeint trace finds the shortest runtime import path connecting two measured files in the working tree.
PHP PSR-4 imports follow the closest composer.json and its declared local Composer path dependencies.
When applications resolve a shared package's import to different files, codeint keeps all of those targets.
When <FROM> or <TO> is a Production file that its Language plugin marks as a program start, the report names "program-start mark" as the entry-point reason in from_entry_point or to_entry_point (and Entry point: <path> (program-start mark) in text format).
When a step on a traced path comes from one import that leads to several files, the report lists that import and every file it leads to in multi_file_imports (and Import <specifier> in <importer> leads to: <targets> in text format).
When no runtime import path connects them, it reports connected: false and exits with code 0:
codeint trace src/sign.ts src/parse.tsfrom: src/sign.ts
to: src/parse.ts
connected: false
shortest_distance: null
paths: []
truncated: false
These commands exercise --all, --max-paths, --output, and each output format:
codeint trace src/sign.ts src/parse.ts --format toon
codeint trace src/sign.ts src/parse.ts --format text
codeint trace src/sign.ts src/parse.ts --all --max-paths 5 --format json --output trace.jsonPassing --package <PATH> for a Workspace package that does not exist stops the run with exit code 2:
codeint trace src/sign.ts src/parse.ts --package packages/missing| Option | Meaning |
|---|---|
--check |
Check whether a newer release is available without modifying the binary |
--version <TAG> |
Install this release tag, such as v0.1.0, instead of the latest release |
-h, --help |
Print the help of codeint update |
codeint update downloads the matching platform archive and SHA256SUMS from GitHub Releases, verifies the SHA-256 digest before touching the binary, and atomically replaces a standalone codeint executable in place.
When run inside a repository whose configuration file uses the codeint schema URL ($schema in JSON/JSONC, #:schema or top-level $schema in TOML, or # yaml-language-server: $schema= or top-level $schema in YAML), codeint update also updates that schema tag to match the installed release.
If the running binary lives inside node_modules, codeint update refuses to overwrite it and exits 2 with the package-manager update command instead.
codeint update --check --version v0.10.5codeint 0.10.5 is already up to date (v0.10.5)
| Option | Meaning |
|---|---|
-h, --help |
Print the help of codeint mcp |
codeint mcp runs a local Model Context Protocol (MCP) server over standard input and standard output with no open network port.
It exposes eight read-only tools (check, diff, trend, guard, impact, trace, churn, and coupling) so coding agents can measure Software entropy and Hazards, inspect architectural boundaries, reverse-dependency blast radius, and import paths, rank high-churn eroded or duplicated files, detect co-change coupling, and fix Regressions before opening a pull request.
Every MCP tool accepts an optional format argument ("toon", the default, or "json") and ignores the repository-configured format key so coding agents receive compact TOON output by default while callers that require strict JSON can pass "format": "json".
Invalid format values and trace calls with max_paths less than 1 are rejected during argument validation, and all eight tools return MCP-tailored error remedies that name MCP arguments instead of CLI flags.
The check MCP tool takes path, package, coverage_reports, all, ignore_baseline (boolean, false by default; the same meaning as codeint check --ignore-baseline), and format.
Its stale-Baseline error names ignore_baseline: true as the way to show every Finding.
It uses coverage_reports from the configuration file, returning Test gap (or its absent form and reason), Test gap Findings ordered heaviest untested Function mass first, any Test gap Budget failure, and the missing-report error when budgets.production.test_gap is set with Test gap absent.
When a measured language defines Hazard line rules (such as SQL), check, diff, and trend also return hazards, check and diff return Hazard line Findings (path, line, and rule name only), and check returns scope_summaries and file_diagnostics.
When standard input closes, the server exits with code 0:
codeint mcp| Argument | Meaning |
|---|---|
<PATH> |
Path to an existing or planned file inside the Git repository |
| Option | Meaning |
|---|---|
--format <FORMAT> |
The format of the output: text, the default, toon, or json |
-h, --help |
Print the help of codeint guard |
codeint guard <path> evaluates the architectural boundary rules (both internal zone rules and allow_external/deny_external external-package rules) in the configuration file for an existing or planned file path without requiring the file to exist on disk.
codeint guard src/route.ts
codeint guard src/route.ts --format text
codeint guard src/route.ts --format toon
codeint guard src/route.ts --format json| Option | Meaning |
|---|---|
--output <FILE> |
Write the schema manifest to this file instead of standard output |
--format <FORMAT> |
The format of the schema manifest: json, the default, or toon |
-h, --help |
Print the help of codeint schema |
codeint schema prints a deterministic, machine-readable manifest describing the running binary version, every CLI command and flag, built-in Metrics, Source sets, built-in Language plugins, output formats, MCP tools, and exit codes.
It is derived directly from live CLI and MCP definitions, works outside a Git repository, and stays 100% local and offline.
codeint schema
codeint schema --format json
codeint schema --format toon
codeint schema --output schema.json| Argument | Meaning |
|---|---|
[PATH] |
A folder inside the Git repository to inspect; the current folder by default |
| Option | Meaning |
|---|---|
--resolved |
Print the effective active configuration and per-field provenance |
--format <FORMAT> |
The format of the output: text, the default, toon, or json |
--budget <SPEC> |
Override a Budget ratio as SOURCE_SET.METRIC=RATIO |
--source-set <SPEC> |
Override a Source set glob as SOURCE_SET=GLOB |
--plugin-memory-mb <MB> |
Override the memory limit in MiB of each Plugin call, plugin_limits.memory_mb (1 to 4096) |
--plugin-timeout-ms <MS> |
Override the time limit in milliseconds of each Plugin call, plugin_limits.timeout_ms (1 to 300000) |
-h, --help |
Print the help of codeint config |
codeint config --resolved prints every effective active setting merged from built-in defaults, the configuration file, and CLI overrides alongside its provenance (default, file, or cli).
codeint config --resolved
codeint config --resolved src --format text
codeint config --resolved --format toon
codeint config --resolved --format json --budget production.erosion=0.25 --source-set test=spec/** --plugin-memory-mb 128 --plugin-timeout-ms 10000| Argument | Meaning |
|---|---|
<INPUT> |
Path to a saved check or diff JSON report, or - to read from standard input |
| Option | Meaning |
|---|---|
--output <FILE> |
Write the report to this file instead of standard output |
--all |
List every Finding in text output instead of capping at 5 per Metric (and include passing Workspace packages on check and resolved Findings on diff) |
--format <FORMAT> |
The format of the report: toon, the default, text, json, sarif, or markdown; overrides format in the configuration file |
--check-run |
Render GitHub Checks API check run requests as JSON without calling the network |
--publish-check-run |
Publish a GitHub Checks API check run using GITHUB_TOKEN or GH_TOKEN from the environment |
--check-run-base <REF> |
Base Git ref used to find changed lines for check run annotations (defaults to the saved diff report's base.merge_base or origin/$GITHUB_BASE_REF) |
--check-run-head-sha <SHA> |
Commit SHA or Git ref to attach the check run to (defaults to GITHUB_SHA, the diff report's head commit, or HEAD) |
--check-run-name <NAME> |
Name of the GitHub check run (codeint by default) |
--check-run-conclusion <MODE> |
Check run conclusion when Findings or gate failures exist: auto (the default: neutral for Findings with passing gates, failure when a gate fails), neutral, or failure; clean runs always conclude success |
--check-run-limit <COUNT> |
Maximum total line annotations across all 50-annotation Checks API requests (250 by default); overflow Findings appear in the summary |
--check-run-repo <REPO> |
GitHub repository (owner/repo) for --publish-check-run (defaults to GITHUB_REPOSITORY) |
-h, --help |
Print the help of codeint report |
codeint report re-renders a saved codeint check --format json or codeint diff --format json payload into another format without re-running analysis, or builds and optionally publishes a GitHub Checks API check run (ADR 0040).
Pass - as <INPUT> to read the JSON payload from standard input.
--format text prints the same concise monochrome text summary as codeint check --format text and codeint diff --format text, and --all matches check --all --format text and diff --all --format text byte for byte.
When --format is omitted inside a Git working tree, codeint report reads format from the repository's configuration; outside any Git repository or inside a bare Git repository, it falls back to toon.
Offline mode stays the default: --check-run prints the batched Checks API POST and PATCH requests (50 annotations per request) as JSON with no network calls, annotating only Findings on lines changed against the base ref and listing remaining Findings, overflow Findings, and gate failures in the summary.
--publish-check-run sends those requests to GitHub using GITHUB_TOKEN or GH_TOKEN from the environment (never as a CLI argument) and requires checks: write permission.
codeint report report.json --format toon
codeint report report.json --format json
codeint report report.json --format sarif --output report.sarif
codeint report report.json --format markdown
codeint report report.json --format text
codeint report report.json --format text --all
codeint report report.json --check-run --check-run-base main --check-run-head-sha HEAD --check-run-name codeint --check-run-conclusion auto --check-run-limit 50
codeint report report.json --check-run --check-run-base main --check-run-conclusion neutral
codeint report report.json --check-run --check-run-base main --check-run-conclusion failureAn input file that does not exist, malformed JSON, an unsupported report schema version, or --publish-check-run without GITHUB_TOKEN or GH_TOKEN stops the run with exit code 2:
codeint report missing.json --format sarif
GITHUB_TOKEN= GH_TOKEN= codeint report report.json --publish-check-run --check-run-base main --check-run-repo owner/repo| Argument | Meaning |
|---|---|
[PATH] |
A folder to inspect; the current folder by default |
| Option | Meaning |
|---|---|
--format <FORMAT> |
The format of the output: text, the default, json, or toon |
-h, --help |
Print the help of codeint doctor |
codeint doctor runs strictly read-only, offline diagnostics on Git repository status, configuration file validity, $schema version compatibility, detected Language plugins, Workspace packages, and external Wasm Plugin paths, SHA-256 digests, and interface compatibility.
It separates passing checks, warnings, and blocking errors, exiting with code 0 when no blocking error is found and code 1 when at least one blocking error is found.
codeint doctor
codeint doctor src
codeint doctor --format text
codeint doctor --format json
codeint doctor --format toon| Command | Meaning |
|---|---|
status |
Report detected local coding agents and whether codeint mcp is registered for each |
install |
Register codeint mcp in supported local coding agent configuration files |
help |
Print the help of codeint agent, or of the subcommand that follows it |
| Option | Meaning |
|---|---|
-h, --help |
Print the help of codeint agent |
codeint agent manages local codeint mcp registration for Claude Code (claude-code, .claude.json), Cursor (cursor, .cursor/mcp.json), and Codex (codex, .codex/config.toml).
Both status and install accept --client <claude-code|cursor|codex>, --format <text|toon|json>, and --config-root <DIR> (or the CODEINT_AGENT_HOME environment variable) to override the home folder.
codeint agent install also accepts --dry-run to preview the exact resulting configuration without modifying any file on disk.
When writing a configuration file, codeint agent install preserves unrelated keys and existing MCP servers, writes atomically via a temporary file rename, and leaves already-registered configurations untouched on repeated runs.
CODEINT_AGENT_HOME=.agent-home codeint agent status
CODEINT_AGENT_HOME=.agent-home codeint agent status --format json
CODEINT_AGENT_HOME=.agent-home codeint agent status --format toon
CODEINT_AGENT_HOME=.agent-home codeint agent install --dry-run --client claude-code
codeint agent help| Command | Meaning |
|---|---|
test |
Run the Conformance runner against a Wasm Plugin and report each violated rule with a fix hint |
help |
Print the help of codeint plugin, or of the subcommand that follows it |
| Option | Meaning |
|---|---|
-h, --help |
Print the help of codeint plugin |
codeint plugin test <WASM> loads one Wasm Plugin through the same sandboxed Plugin host that codeint check uses and runs the Conformance runner against it.
It needs no repository, no configuration file, and no network access.
The runner checks a Language plugin for the following rules:
- It is a valid WebAssembly component that exports
codeint:plugin/language@0.6.0orcodeint:plugin/language@0.5.0and imports no WASI or host interface. - It claims at least one valid extension: not empty, no leading dot, and no
/or whitespace, because such an extension never matches a repository file. Duplicate extensions are allowed. - Its
known-dialectslist holds no empty or duplicate dialect names. - Its
flagged-line-ruleslist holds no empty or duplicate rule names. - Its Hazard rule list matches
has-hazard-rulesand holds no empty rule name. - Its Framework profile names are not empty, because an empty name can never be selected in config.
loweris deterministic and stateless on built-in probe sources, which the runner writes once for every extension the Plugin claims, and on every--sourcefile (and for each known dialect), returns lines counted from 1 inside the file for both LF and CRLF line endings, returns functions and tokens in source order, reports valid diagnostics, lists every Hazard rule it uses inhazard-rules, and rejects a file it does not claim.- Its Framework profiles resolve for the disabled, auto, exclude, and only selections, for the root package and a member package, with every known profile, with each profile alone, and, for three or more profiles, with the first two, sent the real package files and only the manifests
manifest-pathschose, each with the content of the probe file it names, for the packages of the workspace thatanalyze-manifestsreports and for a fixed member package, with entry points and generated paths that are files of the repository, the same inputs and checkscodeint checkuses. Whenknown-framework-profilesis empty, codeint never resolves Framework profiles, so the runner reportsframework-profilesas skipped. - When
has-importsis true, it answersmanifest-paths,analyze-manifests,resolve-imports(with per-package active Framework profiles: none, each known profile, and, for two or more profiles, every known profile active at once), andentry-pointswithout a trap and with valid data;analyze-manifestsreturns only package roots thatcodeint checkaccepts, and returns noinvalid-manifestsentry for no manifests or for a manifest it chose with valid content, andplugin testsends it only manifests thatmanifest-pathschose, becausecodeint checkskips each invalid manifest with a warning and stops on any unknown path or trap. Theend-to-endcheck fails whencodeint checkskips a valid probe manifest with a warning. Whenhas-importsis false, codeint never calls these four, so the runner reports them as skipped. - When
has-scope-analysisis true, it answersanalyze-scopewithout a trap and with valid extra Hazard lines and scope summaries; whenhas-scope-analysisis false, the runner reportsscope-analysisas skipped. - It answers
reference-rangeswith valid data: bounds within0..=1, at most one range per Metric, and every range for a built-in Metric at that Metric's currentmetric_version. A stale range (version 0 or a mismatch) fails with a hint to recalibrate or update it, becausecodeint checkhides such a range behind a note. Ranges for keys that are not built-in Metrics are not version-checked. codeint checkaccepts it end to end: the runner writes the probe files and the manifestsmanifest-pathschose to a temporary Git repository, declares only this Plugin in itscodeint.json, and runs the real measurement pipeline once with no Framework profile configured and once withframework_profilesset to each known profile. Any error that makescodeint checkexit with code 2 failsend-to-endwith the error text, and the temporary folder is removed on every path.- It stays within the memory and time limits of each call; a call that hits a limit fails
limits.
The runner checks a Metric plugin for the following rules:
- It is a valid WebAssembly component that exports
codeint:plugin/metric@0.6.0orcodeint:plugin/metric@0.5.0and imports no WASI or host interface. - Its key is a valid snake_case key that collides with no built-in Metric or reserved report key, its version is 1 or higher, and its name and description are not empty.
measureis deterministic and stateless on an empty Code model and on Code models with functions, tokens, Hazard lines, runtime imports, several Production and Test files, and a Code model with function Coverage, Generated and Vendored files, anonymous functions, every token kind, and a program start, and it returns a ratio between 0 and 1, finite and non-negative numbers, Findings with a non-empty id, lines counted from 1, and paths relative to the repository root.codeint checkaccepts it end to end: the real measurement pipeline measures a small TypeScript probe repository in a temporary Git repository that declares only this Plugin, and any error that makescodeint checkexit with code 2 failsend-to-end.- It stays within the memory and time limits of each call.
Each check prints as pass, fail, or skipped.
A fail names the rule and a fix hint.
A check that needs a Plugin that did not load, a call that codeint never makes for the Plugin, or a measurement that an earlier fail stopped, prints as skipped.
Checks print in a fixed order, and each check appears once.
codeint plugin test exits with code 0 when no check fails and code 1 when at least one check fails.
A path that names no readable file stops the run with exit code 2.
Option of codeint plugin test |
Meaning |
|---|---|
<WASM> |
The path to the Wasm Plugin to check |
--kind <KIND> |
The kind of Plugin to check: language, the default, or metric |
--source <FILE> |
A source file for a Language plugin to lower in addition to the built-in probe sources; may repeat |
--plugin-memory-mb <MB> |
The memory limit in MiB for each Plugin call, from 1 to 4096; 64 by default |
--plugin-timeout-ms <MS> |
The time limit in milliseconds for each Plugin call, from 1 to 300000; 5000 by default |
--format <FORMAT> |
The format of the output: text, the default, json, or toon |
The built-in probe sources run once for every extension that the Plugin claims.
A Plugin whose Hazard rules or Flagged lines fire only on specific text needs a --source file that holds that text, or the runner cannot check those rules.
codeint plugin test plugins/sample_mini_plugin.wasm
codeint plugin test plugins/sample_mini_plugin.wasm --kind language --source plugins/sample.mini
codeint plugin test plugins/sample_mini_plugin.wasm --plugin-memory-mb 128 --plugin-timeout-ms 10000
codeint plugin test plugins/sample_long_functions_plugin.wasm --kind metric
codeint plugin test plugins/sample_mini_plugin.wasm --format json
codeint plugin test plugins/sample_long_functions_plugin.wasm --kind metric --format toon
codeint plugin helpA Plugin that breaks a rule exits with code 1, and the report names the rule and the fix:
codeint plugin test plugins/out_of_range_ratio_metric_plugin.wasm --kind metric
codeint plugin test plugins/legacy_v0_3_0_language_plugin.wasm --format jsoncodeint plugin test plugins/missing.wasm| Command | Meaning |
|---|---|
update |
Create or monotonically tighten .codeint/ratchet.json from the current working tree |
help |
Print the help of codeint ratchet, or of the subcommand that follows it |
| Option | Meaning |
|---|---|
-h, --help |
Print the help of codeint ratchet |
codeint ratchet update measures the whole repository and writes each measured Metric's ceiling ratio (rounded to 4 decimal places) alongside its positive integer Metric version to .codeint/ratchet.json (or the configured ratchet.path).
It creates the Ratchet file on the first run, lowers ceilings whenever a Metric improves, keeps equal ceilings unchanged, and automatically refreshes entries whose Metric version changed.
Without --reset, it preserves existing entries for Metrics not measured in the current run (such as Production Test gap when no Coverage report is passed) and counts them in unchanged with removed equal to 0.
With --reset, it prunes unmeasured entries and reports them in removed.
When any unchanged-version Metric has risen above its stored ceiling, codeint ratchet update stops with exit code 2 without modifying the file unless you pass --reset.
When the existing Ratchet file is not valid JSON or fails validation, codeint ratchet update --reset replaces it with a regenerated file and says so; without --reset it stops with exit code 2.
codeint ratchet update accepts an optional [PATH] folder inside the repository, --reset, --coverage-report <PATH> (repeatable), and --format <text|toon|json> (text by default).
codeint ratchet update
codeint ratchet update --format json
codeint ratchet update --reset --format toon
codeint ratchet help| Command | Meaning |
|---|---|
update |
Create .codeint/baseline.json, or remove fixed Findings from it, from the current working tree |
help |
Print the help of codeint baseline, or of the subcommand that follows it |
| Option | Meaning |
|---|---|
-h, --help |
Print the help of codeint baseline |
A Baseline is a committed list of existing Findings in .codeint/baseline.json that codeint check hides and removes permanently as those Findings are fixed (ADR 0030, ADR 0032).
In schema_version 2, each recorded Finding stores its id, its occurrence-free content hash, optional one-way hashes of the nearest preceding and following non-empty token lines, and a 1-based line hint (never raw source text), alongside each Metric's positive integer Metric version per Source set and for Dependency hygiene.
codeint check and codeint baseline update still read schema_version 1 files cleanly using exact id matching, and codeint baseline update upgrades them to schema_version 2.
A repository without .codeint/baseline.json reports exactly as before.
codeint baseline update measures the whole repository and writes .codeint/baseline.json:
- On the first run, it records every current Finding of every measured Metric.
- When a run measures a Metric that has no entry in the Baseline yet, such as Test gap on the first run with a Coverage report, it records that Metric's current Findings, as the first run would.
- For a Metric that already has an entry, it removes each Finding that is fixed and never adds a new Finding; it names the count of new Findings it left out.
- When a Metric's Metric version changed, it replaces that Metric's Findings with the current Findings and records the new Metric version.
- With
--reset, it replaces every measured Metric's Findings with the current Findings, so new Findings join the Baseline. - It keeps the entries of Metrics that this run does not measure, such as Test gap without a Coverage report.
When the existing Baseline file is not valid JSON or fails validation, codeint baseline update --reset replaces it with a regenerated file and says so; without --reset it stops with exit code 2.
The file is committed, so the old content is recoverable from Git.
codeint baseline update accepts an optional [PATH] folder inside the repository, --reset, --coverage-report <PATH> (repeatable), and --format <text|toon|json> (text by default).
codeint baseline update
codeint baseline update --format json
codeint baseline update --reset --format toon
codeint baseline helpWhen .codeint/baseline.json exists, codeint check (including --package runs and the MCP check tool):
- hides every Finding that matches an entry in the Baseline for that Metric and Source set (pairing identical-content Findings by their hashed surrounding-line context anchors so inserting a duplicate above a legacy Finding blames the new line, while a single untouched Finding still matches when neighboring lines change), and counts hidden Findings in
baselined_findingson the Metric and in the top-levelbaselineobject (pathandhidden_findings); - keeps every Metric ratio as measured, so Reference ranges and the Ratchet still see the whole repository;
- compares each Budget with the non-baselined ratio: the measured ratio scaled by the share of the Metric's Finding weight that the Baseline does not hide, and marks such Budget failures with
non_baselined; - stops with exit code 2 and names
codeint baseline updatewhen a Metric version in the Baseline differs from the current Metric version.
codeint check --ignore-baseline ignores .codeint/baseline.json: it shows every Finding, evaluates Budgets on every Finding, and skips the Metric version check.
When .codeint/baseline.json exists, codeint diff also compares each head Budget with the non-baselined ratio.
New Duplication Baseline entries store hashed clone line occurrences.
An unchanged occurrence stays covered when a Clone group loses a member or overlapping spans combine.
The Duplication Budget counts only uncovered clone lines, and the report hides groups whose lines are all covered.
Older entries still match by Clone group.
Run codeint baseline update on the existing Baseline before editing clone spans to record anchors for unchanged Clone group IDs.
This upgrade keeps the same Metric version and adds no Finding IDs for Duplication.
Zero Budgets written by codeint init --adopt therefore pass on clean pull requests and fail on any new Finding.
When a Baseline Metric version differs from the current Metric version, codeint diff stops with exit code 2 and names codeint baseline update.
Base-versus-head Finding classification, Regressions, per-file checks, new-file Budgets, and Ratchet enforcement stay unchanged.
| Command | Meaning |
|---|---|
check |
Verify that .codeint/ratchet.json and .codeint/baseline.json were not weakened relative to a base Git ref |
help |
Print the help of codeint state, or of the subcommand that follows it |
| Option | Meaning |
|---|---|
-h, --help |
Print the help of codeint state |
codeint state check <BASE_REF> [PATH] compares each revision's configured Ratchet file (.codeint/ratchet.json by default, or ratchet.path from that revision's configuration file) and .codeint/baseline.json in the working tree, or at --head <REF>, against the merge-base of <BASE_REF>.
It reads state files without parsing source files, except when verifying a legacy Duplication Baseline upgrade.
For the upgrade, it measures the base commit with built-in Language plugins to check that new anchors cover existing clone lines.
Repository-contained file and directory symlinks resolve consistently across Git commits and the working tree, while escaping or broken symlinks fail with exit code 2.
It passes with exit code 0 when state files are adopted for the first time, unchanged, tightened, upgraded across a Metric version change, or when .codeint/baseline.json is deleted.
It fails with exit code 1 when .codeint/ratchet.json is deleted, a recorded Ratchet entry is removed, a Ratchet ceiling is raised at the same Metric version, or .codeint/baseline.json adds unmatched Findings at the same Metric version.
When both base and head Baselines exist and --rename-threshold is greater than 0 (50 by default; 0 disables rename detection), codeint state check detects renamed files in process so moved Baseline Findings stay matched.
codeint state check accepts --head <REF>, --rename-threshold <PERCENT> (0 to 100, default 50), --output <FILE>, and --format <toon|text|json> (toon by default).
codeint state check main
codeint state check main --format json
codeint state check main --head feature --format text
codeint state help| Option | Meaning |
|---|---|
--since <WINDOW> |
Lookback window in days (such as 90d) or a UTC date (YYYY-MM-DD); defaults to 90d |
--commits <COUNT> |
Walk at most this many main-line commits from HEAD |
--output <FILE> |
Write the report to this file instead of standard output |
--all |
List every Finding instead of the 20 worst per Metric |
--format <FORMAT> |
The format of the report: toon, the default, text, json, or markdown |
-h, --help |
Print the help of codeint churn |
codeint churn walks main-line Git history natively via gix to count per-file commit touches over the configured window, then ranks eroded and duplicated files independently per Metric without any blended score.
When filtering by --since, codeint compares the committer date and scans up to 14 days earlier than the cutoff before stopping so out-of-order commit timestamps do not truncate newer commits.
In a shallow clone, codeint churn stops at the shallow boundary and includes a structured warning in the report.
codeint churn
codeint churn --since 90d --format text
codeint churn --commits 10 --all --format toon
codeint churn --format json --output churn.json
codeint churn --format markdown| Option | Meaning |
|---|---|
--since <WINDOW> |
Lookback window in days (such as 90d) or a UTC date (YYYY-MM-DD); defaults to 90d |
--commits <COUNT> |
Walk at most this many main-line commits from HEAD |
--output <FILE> |
Write the report to this file instead of standard output |
--all |
List every Finding instead of the 20 worst per Metric |
--format <FORMAT> |
The format of the report: toon, the default, text, json, or markdown |
--max-commit-files <COUNT> |
Exclude commits touching more than this many files from co-change pair accumulation; defaults to 50 |
--min-co-changes <COUNT> |
Report only pairs that changed together in at least this many commits; defaults to 3 |
--min-ratio <RATIO> |
Report only pairs whose coupling ratio is at least this value between 0 and 1; defaults to 0.3 |
--include-tests |
Include Test Source set files alongside Production files |
-h, --help |
Print the help of codeint coupling |
codeint coupling walks main-line Git history natively via gix to find pairs of files that repeatedly change together in the same commits, excludes bulk commits above --max-commit-files, and flags whether each coupled pair has a direct runtime import edge.
When filtering by --since, codeint compares the committer date and scans up to 14 days earlier than the cutoff before stopping so out-of-order commit timestamps do not truncate newer commits.
By default it measures Production files only; pass --include-tests to include Test files as well.
codeint coupling
codeint coupling --since 90d --max-commit-files 50 --min-co-changes 3 --min-ratio 0.3 --format text
codeint coupling --commits 10 --include-tests --all --format toon
codeint coupling --format json --output coupling.json
codeint coupling --format markdown| Exit code | Meaning |
|---|---|
0 |
The run succeeded, and no Budget, Ratchet, Regression, codeint state check violation, blocking doctor error, or failed codeint plugin test check occurred |
1 |
The run succeeded, and at least one Budget, Ratchet, Regression, codeint state check violation, blocking doctor error, or codeint plugin test check failed; codeint still writes the whole report and names each failure on standard error |
2 |
An operational error stopped the run, such as an unknown option, a Git ref that names no commit, a Ratchet or Baseline Metric version mismatch, or an invalid configuration file; codeint names the error on standard error |
codeint reads one dedicated configuration file at the root of the Git repository from ten supported paths: codeint.json, codeint.jsonc, codeint.toml, codeint.yaml, codeint.yml, .codeint/config.json, .codeint/config.jsonc, .codeint/config.toml, .codeint/config.yaml, or .codeint/config.yml (ADR 0034).
JSON and JSONC files accept // line comments, /* ... */ block comments, and trailing commas before } or ].
TOML and YAML files use the same configuration keys and schema: empty or comment-only files resolve to defaults, while non-mapping top-level values, duplicate keys, multi-document YAML streams, non-string YAML mapping keys, YAML anchors or aliases, YAML merge keys, non-finite floats, and TOML native date-time values stop the run with exit code 2.
TOML and YAML recognize both a leading schema comment directive (#:schema <url> for TOML, # yaml-language-server: $schema=<url> for YAML) and a top-level $schema key; specifying both with different URLs stops the run with exit code 2.
Keep only one of those ten files in the repository; having more than one stops the run with exit code 2 and names every conflicting file.
Without any configuration file, codeint uses the default of every key.
codeint init writes a starter codeint.jsonc by default (or codeint.json, codeint.toml, or codeint.yaml with --format, never replacing an existing configuration file at any of the ten paths), and schema/codeint.schema.json is its JSON schema.
In the key paths below, [] stands for each item of a list, and a name in braces stands for each of its values:
| Placeholder | Values |
|---|---|
{source_set} |
production, test, generated, vendored |
{metric} |
erosion, cognitive_complexity, duplication, verbosity, import_cycles |
{dependency_metric} |
unused_dependencies, unlisted_dependencies, dev_in_production_dependencies |
| Key | Type | Meaning |
|---|---|---|
$schema |
string | The address of the JSON schema, for editors; when it points to a newer official codeint release tag than the running binary, codeint exits with code 2 |
format |
string | Default output format for check, diff, trend, report, impact, trace, churn, and coupling: toon (default), text, json, sarif, or markdown; CLI --format always overrides it; see Default output format |
source_sets |
object | Globs that put files into a Source set; see Source sets |
source_sets.{source_set} |
list of strings | Globs of repository-relative paths that belong to this Source set; empty by default |
budgets |
object | The Budgets of each Source set and dependency hygiene Metric; see Budgets |
budgets.{source_set} |
object | The Budgets of this Source set; empty by default |
budgets.{source_set}.{metric} |
number from 0 to 1 | The highest ratio of this Metric in this Source set |
budgets.{source_set}.boundaries |
number from 0 to 1 | The highest Boundaries ratio in this Source set |
budgets.production.orphan_files |
number from 0 to 1 | The highest Orphan files ratio in the Production Source set; setting orphan_files under any other Source set stops the run with exit code 2 |
budgets.{source_set}.hazards |
number from 0 to 1 | The highest Hazards ratio in this Source set; passes when Hazards is absent; see Hazards |
budgets.production.test_gap |
number from 0 to 1 | The highest Test gap ratio in the Production Source set; setting test_gap under any other Source set stops the run with exit code 2 |
budgets.production.file_size |
number from 0 to 1 | The highest File size ratio in the Production Source set; setting file_size under any other Source set stops the run with exit code 2; see File size |
budgets.{dependency_metric} |
number from 0 to 1 | The highest ratio of this Dependency hygiene Metric across workspace packages |
new_file_budgets |
object | The Budgets enforced across newly added files in codeint diff, per Source set; see New-file Budgets |
new_file_budgets.{source_set} |
object | The new-file Budgets of this Source set; empty by default |
new_file_budgets.{source_set}.{metric} |
number from 0 to 1 | The highest ratio of this Metric across newly added files in this Source set |
new_file_budgets.{source_set}.boundaries |
number from 0 to 1 | The highest Boundaries ratio across newly added files in this Source set |
new_file_budgets.production.orphan_files |
number from 0 to 1 | The highest Orphan files ratio across newly added Production files; setting orphan_files under any other Source set stops the run with exit code 2 |
new_file_budgets.{source_set}.hazards |
number from 0 to 1 | The highest Hazards ratio across newly added files in this Source set; passes when Hazards is absent; see Hazards |
new_file_budgets.production.test_gap |
number from 0 to 1 | The highest Test gap ratio across newly added Production files; setting test_gap under any other Source set stops the run with exit code 2 |
new_file_budgets.production.file_size |
number from 0 to 1 | The highest File size ratio across newly added Production files; setting file_size under any other Source set stops the run with exit code 2 |
regression_limits |
object | How much each Metric may get worse in codeint diff; see Regression limits |
regression_limits.per_file |
boolean | When true, codeint diff compares file-level Metric numerators and Findings for every modified file and fails if any modified file worsens; false by default |
regression_limits.{metric} |
object | The Regression limit of this Metric in every Source set |
regression_limits.{metric}.ratio_rise |
number from 0 to 1 | The highest ratio rise that passes |
regression_limits.{metric}.new_findings |
string | When new Findings or a numerator rise are a Regression: any_new_finding, numerator_rise (or deprecated alias numerator_rise_with_new_findings), or never |
regression_limits.boundaries |
object | The Regression limit of Boundaries in every Source set |
regression_limits.boundaries.ratio_rise |
number from 0 to 1 | The highest Boundaries ratio rise that passes |
regression_limits.boundaries.new_findings |
string | When new Boundaries Findings or a numerator rise are a Regression: any_new_finding (default), numerator_rise, or never |
regression_limits.orphan_files |
object | The Regression limit of Orphan files in the Production Source set |
regression_limits.orphan_files.ratio_rise |
number from 0 to 1 | The highest Orphan files ratio rise that passes |
regression_limits.orphan_files.new_findings |
string | When new Orphan files Findings or a numerator rise are a Regression: any_new_finding (default), numerator_rise, or never |
regression_limits.hazards |
object | The Regression limit of Hazards in every Source set; see Hazards |
regression_limits.hazards.ratio_rise |
number from 0 to 1 | The highest Hazards ratio rise that passes; 0.01 by default |
regression_limits.hazards.new_findings |
string | When new Hazards Findings or a numerator rise are a Regression: any_new_finding (default), numerator_rise, or never |
regression_limits.{dependency_metric} |
object | The Regression limit of this Dependency hygiene Metric |
regression_limits.{dependency_metric}.ratio_rise |
number from 0 to 1 | The highest ratio rise that passes |
regression_limits.{dependency_metric}.new_findings |
string | When new Dependency hygiene Findings or a numerator rise are a Regression: any_new_finding (default), numerator_rise, or never |
regression_limits.{source_set} |
object | The Regression limits of this Source set only |
regression_limits.{source_set}.{metric} |
object | The Regression limit of this Metric in this Source set |
regression_limits.{source_set}.{metric}.ratio_rise |
number from 0 to 1 | The highest ratio rise that passes |
regression_limits.{source_set}.{metric}.new_findings |
string | When new Findings or a numerator rise are a Regression: any_new_finding, numerator_rise (or deprecated alias numerator_rise_with_new_findings), or never |
regression_limits.{source_set}.boundaries |
object | The Regression limit of Boundaries in this Source set |
regression_limits.{source_set}.boundaries.ratio_rise |
number from 0 to 1 | The highest Boundaries ratio rise that passes |
regression_limits.{source_set}.boundaries.new_findings |
string | When new Boundaries Findings or a numerator rise are a Regression: any_new_finding (default), numerator_rise, or never |
regression_limits.production.orphan_files |
object | The Regression limit of Orphan files in the Production Source set; setting orphan_files under any other Source set stops the run with exit code 2 |
regression_limits.production.orphan_files.ratio_rise |
number from 0 to 1 | The highest Orphan files ratio rise that passes |
regression_limits.production.orphan_files.new_findings |
string | When new Orphan files Findings or a numerator rise are a Regression: any_new_finding (default), numerator_rise, or never |
regression_limits.file_size |
object | The Regression limit of File size in the Production Source set; see File size |
regression_limits.file_size.ratio_rise |
number from 0 to 1 | The highest File size ratio rise that passes; 0.01 by default |
regression_limits.file_size.new_findings |
string | When new Oversized files or a numerator rise are a Regression: any_new_finding, numerator_rise (default), or never |
regression_limits.production.file_size |
object | The Regression limit of File size in the Production Source set; setting file_size under any other Source set stops the run with exit code 2 |
regression_limits.production.file_size.ratio_rise |
number from 0 to 1 | The highest File size ratio rise that passes |
regression_limits.production.file_size.new_findings |
string | When new Oversized files or a numerator rise are a Regression: any_new_finding, numerator_rise (default), or never |
regression_limits.{source_set}.hazards |
object | The Regression limit of Hazards in this Source set; see Hazards |
regression_limits.{source_set}.hazards.ratio_rise |
number from 0 to 1 | The highest Hazards ratio rise that passes in this Source set |
regression_limits.{source_set}.hazards.new_findings |
string | When new Hazards Findings or a numerator rise are a Regression in this Source set: any_new_finding (default), numerator_rise, or never |
languages |
list of objects | Which Language plugin measures which folders; see Languages |
languages[].plugin |
string | The name of the Language plugin, such as typescript-javascript |
languages[].include |
list of strings | Globs of repository-relative folders or files that the Language plugin measures; a folder covers every file below it |
languages[].exclude |
list of strings | Globs inside the included folders that the Language plugin leaves out; empty by default |
plugins |
list of objects | External WebAssembly component Language and Metric plugins to load from local paths or HTTPS URLs; see Plugins |
plugins[].name |
string | The name of the external Plugin |
plugins[].kind |
string | Whether the external Plugin is a Language plugin or a Metric plugin: language (the default) or metric |
plugins[].path |
string | Path to the WebAssembly component file, relative to the repository root or absolute; set either path or url, not both |
plugins[].url |
string | HTTPS URL of the WebAssembly component file; set either path or url, not both |
plugins[].sha256 |
string | The required 64-character hexadecimal SHA-256 digest of the plugin file |
plugin_limits |
object | Memory cap and time limit enforced on each WebAssembly Plugin; see Plugins |
plugin_limits.memory_mb |
integer from 1 to 4096 | Maximum linear memory in MiB that a WebAssembly Plugin may allocate; 64 by default |
plugin_limits.timeout_ms |
integer from 1 to 300000 | Maximum wall-clock time in milliseconds for each WebAssembly Plugin call; 5000 by default |
boundaries |
object | Architectural import boundaries defining named zones, optional public_files entry points, directional internal allow or deny rules, external-package allow_external or deny_external glob rules, and optional strict_zones mode |
boundaries.preset |
string | Optional built-in architecture preset (layered or hexagonal) providing default zones and internal rules that can be overridden or extended |
boundaries.zones |
object | Map of zone name to zone definition (patterns globs and optional public_files globs) |
boundaries.rules |
list of objects | Directional import rules between architectural zones and for external packages |
boundaries.rules[].from |
string | Source zone name, or * to match any zone without a specific rule |
boundaries.rules[].allow |
list of strings | Target zone names (or *) that the source zone is allowed to import; mutually exclusive with deny |
boundaries.rules[].deny |
list of strings | Target zone names (or *) that the source zone is forbidden to import; mutually exclusive with allow |
boundaries.rules[].allow_external |
list of strings | External package name globs that the source zone is allowed to import (use [] to forbid all third-party packages while still permitting standard-library built-ins); mutually exclusive with deny_external |
boundaries.rules[].deny_external |
list of strings | External package name globs that the source zone is forbidden to import; mutually exclusive with allow_external |
boundaries.rules[].reason |
string | Optional human-readable explanation shown in boundary Findings |
boundaries.strict_zones |
boolean | When true, report files in evaluated Source sets that do not match any configured zone; false by default |
boundaries.source_sets |
list of strings | Source sets evaluated by boundary rules; defaults to ["production"] when omitted or empty |
dependencies |
object | Dependency hygiene settings; see Dependencies |
dependencies.ignore |
list of strings | Canonical external package names excluded from unused, unlisted, and dev-in-production dependency Findings; empty by default |
duplication |
object | Settings for Duplication detection, including opt-in shingle-based near-clone detection; see Duplication |
duplication.near_clones |
boolean | When true, detect near-duplicate code blocks using shingle similarity in addition to exact Clone groups; false by default |
duplication.min_similarity |
number in (0, 1] | Minimum Jaccard shingle similarity required for two blocks to match as a near-clone; 0.85 by default |
file_size |
object | Settings for the File size Metric; File size is measured only when max_source_lines is set; see File size |
file_size.max_source_lines |
integer from 1 to 1000000 | The File size limit: the most source lines one Production file may hold before its further lines count toward File size; unset by default |
entry_points |
list of strings | Globs of repository-relative paths treated as additional Production entry points for Orphan files detection, including overriding the Orphan files exclusion (not dev_in_production_dependencies) for matching Tooling files; empty by default |
coverage_reports |
list of strings | Paths relative to the repository root of LCOV or Cobertura XML Coverage reports used to measure Test gap; empty by default; see Test gap |
dialects |
object | Per-language Dialect mappings keyed by Language plugin name (such as dialects.sql), where each entry lists a dialect accepted by that plugin's known-dialects export (for sql: postgresql, mysql, sqlite, or duckdb; unconfigured SQL files use generic SQL) and include globs of repository-relative folders or files; empty by default; see SQL |
hazards |
object | Hazards Metric settings; see Hazards |
hazards.disabled_rules |
list of strings | Names of Hazard line rules turned off across the repository; empty by default |
framework_profiles |
boolean, list of strings, or object | Global Framework profile selection (false to disable all, true for auto-detection, a list of profile names or {"only": [...]} to allow-list, or {"exclude": [...]} to exclude named profiles); auto-detected by default; see Framework profiles |
packages |
object | Per-Workspace-package configuration overrides keyed by repository-relative package root (or "." for the repository root), such as packages.<path>.framework_profiles; empty by default; see Framework profiles |
ratchet |
object | Ratchet settings; see Ratchet |
ratchet.path |
string | Path relative to the repository root of the Ratchet file; .codeint/ratchet.json by default |
A key that the schema does not have, or a value of the wrong type, stops the run with exit code 2 and names the key.
With this codeint.json:
{ "budget": { "production": { "erosion": 0.2 } } }codeint check names the unknown key:
codeint checkcodeint: codeint.json has an unknown key budget; the keys allowed there are $schema, format, source_sets, budgets, new_file_budgets, regression_limits, languages, plugins, plugin_limits, boundaries, dependencies, duplication, file_size, entry_points, coverage_reports, dialects, hazards, framework_profiles, packages, ratchet
Remove the key, or correct its spelling to one of the allowed keys.
Set format to choose the default output format for check, diff, trend, report, impact, trace, churn, and coupling: toon (the built-in default), text, json, sarif, or markdown.
CLI --format always overrides format in the configuration file.
Utility commands (doctor, guard, config, ratchet, baseline, agent, plugin test), schema, and MCP tools ignore format and keep their own defaults.
When one of the eight analysis and report commands does not support the configured format, codeint stops with exit code 2 and names the command, the configured format, and the supported formats.
{ "format": "text" }codeint checkcodeint check: PASS (4 files, 39 source lines)
Production (4 files, 39 lines)
Metric Ratio Reference Status
Erosion 0.7986 0.187-0.671 ok
Cognitive complexity 0 0.121-0.532 ok
Duplication 0 0.018-0.252 ok
Verbosity 0.0256 0-0.002 ok
Import cycles 0 0-0.182 ok
Production Erosion findings (1):
src/route.ts:1 route cc=16 lines=18 mass=67.8823
Production Verbosity findings (1):
src/sign.ts:4 else-after-return
Notes
Test gap is not measured because no Coverage report was named.
skipped (1): src/broken.ts (cannot parse: Unexpected token at line 1, column 23)
declaration-only: 1 file
Each file belongs to one Source set: production, test, generated, or vendored.
Source sets settle in strict priority order from lowest to highest:
- Per-file lowering by the Language plugin.
- Core Vendored (
vendor/,third_party/) and standard build-folder (dist/,build/,out/,coverage/, minified lines) rules. - Active Framework profile
generated_paths, which reclassify matching non-Vendored files togeneratedand never overridevendored. - Explicit
source_setsglobs in the configuration file, which always win.
typescript-javascriptputs a file intestwhen its name ends in.test.{extension}or.spec.{extension}, such assrc/greet.test.ts, or when any folder in its path is named__tests__,test, ortests, such astest/greet.tsorpackages/app/tests/setup.ts. A file namedtest.tsortests.tsoutside such a folder stays inproduction.rustputs a file intestwhen any folder in its path is namedtestsorbenches, when its name ends in_test.rsor_tests.rs, or when its name istests.rs. Inline#[cfg(test)]modules inside a production file are skipped fromproductionmetrics.phpputs a file intestwhen any folder in its path is namedtestsortest, or when its name ends inTest.php.dartputs a file intestwhen any folder in its path is namedtest,tests, orintegration_test, or when its name ends in_test.dart, and puts files ending in.g.dart,.freezed.dart,.gr.dart,.mocks.dart,.pb.dart,.pbenum.dart,.pbjson.dart, or.pbserver.dartintogenerated.pythonputs a file intestwhen any folder in its path is namedtestortests, when its name starts withtest_, ends with_test.py, or isconftest.py, and puts files ending in_pb2.pyor_pb2_grpc.pyintogenerated.goputs a file intestwhen its name ends in_test.goor when any folder in its path is namedtestdata, puts a file ingeneratedwhen a line comment before any code matches// Code generated ... DO NOT EDIT., and puts files undervendor/invendored.goevaluates no build conditions, so platform-specific files are measured like any other file.sqlputs a file ingeneratedwhen its first 20 lines contain a database dump header (-- PostgreSQL database dump,-- Dumped by pg_dump,-- MySQL dumpfollowed by a space,-- MariaDB database dump, or-- MariaDB dumpfollowed by a space) or-- Code generatedwithDO NOT EDIT.(case-insensitive), when any line starts with a migration tool marker (--> statement-breakpoint,-- atlas:txmode, or-- atlas:nolint), or when its path lies underprisma/migrations/ordrizzle/; puts a file intestwhen any folder in its path is namedtest,tests,fixtures, ortestdata, or when its file name ends with.test.sqlor starts withtest_(and ends with.sql); and puts every other.sqlfile (including hand-written migrations) inproduction.shellputs a file intestwhen any folder in its path is namedtest,tests, orspec, or when its name starts withtest_or ends with_testor.testbefore the.sh,.bash, or.zshextension; puts Autotools helper scripts such asltmain.shandconfigure.sh, and files whose header comment contains a generated-file marker (such asCode generated,DO NOT EDIT,do not modify by hand, orthis file is generated), ingenerated; and puts files undervendor/orthird_party/invendored.- Core rules put files under
vendor/orthird_party/intovendored, and files with generated-file markers (such as@generatedorGENERATED CODE) intogenerated.
Globs under source_sets win over every rule.
Globs match the repository-relative path with forward slashes: * matches within one folder, and ** matches across folders.
When globs of several Source sets match one file, the first of vendored, generated, test, and production wins.
{
"source_sets": {
"test": ["src/route.ts"],
"generated": ["src/**/*.generated.ts"],
"vendored": ["vendor/**"],
"production": []
}
}codeint check --format jsonA Budget is the highest ratio a Metric may reach in one Source set.
Each Budget is a number from 0 to 1.
A Budget applies only to its own Source set, and a Metric without a Budget never fails.
A Budget applies to the total of every language, never to the section of one Language plugin under languages.
For Import cycles, Orphan files, Import boundaries, and Dependency hygiene, repository totals and Budgets count only languages with imports.
When no measured language has imports, those repository totals are absent and Budgets on them do not fail.
For Hazards, repository totals and Budgets count only languages whose Language plugin defines Hazard line rules; when Hazards is absent, a Hazards Budget passes.
budgets.production.orphan_files applies to the Production Source set only; setting orphan_files under budgets.test, budgets.generated, or budgets.vendored stops the run with exit code 2 and names the key.
budgets.production.test_gap applies to the Production Source set only; setting test_gap under budgets.test, budgets.generated, or budgets.vendored stops the run with exit code 2 and names the key.
budgets.production.file_size applies to the Production Source set only; setting file_size under budgets.test, budgets.generated, or budgets.vendored stops the run with exit code 2 and names the key.
Without file_size.max_source_lines, a File size Budget stops the run with exit code 2 and names both keys, because File size measures nothing without a limit.
When budgets.production.test_gap is set and Test gap is absent (no Coverage report applies), codeint stops the run with exit code 2 and reports that the Budget needs a Coverage report; with no Test gap Budget, an absent Test gap changes no exit code.
codeint compares each Budget with the ratio as the report shows it, rounded to four decimal places, so a ratio equal to its Budget passes.
{
"budgets": {
"production": { "erosion": 0.2, "duplication": 0.05, "verbosity": 0.1, "import_cycles": 0 },
"test": { "duplication": 0.2 }
}
}When a Metric is over its Budget, codeint still writes the whole report, lists the Metric under over_budget, names it on standard error, and exits with code 1:
codeint checkcodeint: the production erosion ratio 0.7986 is over its Budget 0.2
new_file_budgets sets stricter per-Source-set Budgets that codeint diff enforces solely across files present in the head snapshot and absent at the merge-base.
When a change adds no new files, new_file_budgets stays silent and adds no failures.
Repository-wide Dependency hygiene keys are not allowed under new_file_budgets, and orphan_files and test_gap are accepted under new_file_budgets.production only; setting them under another Source set stops the run with exit code 2.
new_file_budgets.production.test_gap uses the named coverage_reports to measure Test gap across newly added Production files.
For a working-tree diff, codeint reads the reports from disk, including files Git ignores.
For codeint diff <base> --head <ref>, codeint reads the reports at the configured paths from the selected head ref.
If the selected head ref lacks a named report, codeint exits with code 2 and names the missing path.
If new Production files need measurement and no report covers any of their languages, codeint exits with code 2.
When a Metric across the newly added files exceeds its new-file Budget, codeint diff writes the full report, lists each failure under over_new_file_budget (and under runs[0].properties.newFileBudgetFailures in SARIF), names it on standard error, and exits with code 1:
{
"coverage_reports": ["coverage/lcov.info"],
"new_file_budgets": {
"production": {
"erosion": 0,
"boundaries": 0,
"orphan_files": 0,
"hazards": 0,
"test_gap": 0.2
}
}
}codeint diff mainA key of regression_limits named after a Metric sets its limit in every Source set.
A key named after a Source set holds limits for that Source set only:
{
"regression_limits": {
"erosion": { "ratio_rise": 0.02 },
"import_cycles": { "new_findings": "numerator_rise" },
"generated": { "duplication": { "ratio_rise": 1 } },
"production": { "erosion": { "new_findings": "any_new_finding" } }
}
}codeint diff mainEach limit has two settings, and you may set either one or both:
ratio_riseis the highest ratio rise that passes, a number from 0 to 1; the default is 0.01.new_findingssays when new Findings or a numerator rise are a Regression.any_new_findingfails on any new Finding or numerator rise, the default for Import cycles, Boundaries, Orphan files, Hazards, and Dependency hygiene.numerator_risefails whenever the numerator rises (rounded to four decimal places), the default for Erosion, Cognitive complexity, Duplication, Verbosity, and external Metrics;numerator_rise_with_new_findingsis accepted as a deprecated 0.x alias fornumerator_rise.neverlets new Findings and numerator rises pass; together withratio_rise: 1, the Metric never makes a Regression there, which suits thegeneratedandvendoredSource sets.
codeint settles each setting on its own: the Source set limit wins, then the Metric limit, then the default.
So the example above gives production Erosion a ratio rise limit of 0.02 and fails it on any new Finding.
Set regression_limits.per_file to true (false by default) to prevent a change from worsening one modified file while shrinking another file:
{
"regression_limits": {
"per_file": true
}
}codeint diff maincodeint: the production erosion numerator eroded_function_mass rose from 44.8999 to 67.8823
codeint: file src/route.ts regressed in production erosion: eroded_function_mass rose from 0 to 67.8823
When per_file is true, each modified file is checked against its own base file-level numerator (and new Findings when new_findings is any_new_finding), while Metrics configured with new_findings: "never" skip per-file checks.
Unmodified files and modified files that improve or stay equal pass.
Setting orphan_files under regression_limits.test, regression_limits.generated, or regression_limits.vendored stops the run with exit code 2 and names the key, because Orphan files applies to the Production Source set only (use regression_limits.orphan_files or regression_limits.production.orphan_files).
Setting test_gap under regression_limits (at the top level or under any Source set) stops the run with exit code 2 and names the key, because the base and head comparison omits Test gap.
An invalid limit stops the run with exit code 2 and names the key:
{ "regression_limits": { "production": { "erosion": { "ratio_rise": 1.5 } } } }codeint diff maincodeint: codeint.json: regression_limits.production.erosion.ratio_rise must be between 0 and 1, not 1.5
Set the value to a ratio from 0 to 1, as the report shows ratios.
Each entry of languages names a Language plugin, the globs of the folders or files it measures, and the globs it leaves out.
Several entries may name one Language plugin; it measures what any of them includes.
Without languages, every Language plugin measures the whole repository; with it, a Language plugin measures only what its entries include.
When two Language plugins claim the same file extension for the same folder, codeint stops with exit code 2 until languages assigns separate folders to each plugin.
codeint ships eight built-in Language plugins:
| Plugin name | Extensions | Workspace manifest |
|---|---|---|
typescript-javascript |
.ts, .tsx, .mts, .cts, .js, .jsx, .mjs, .cjs, .vue, .svelte |
package.json / pnpm-workspace.yaml |
rust |
.rs |
Cargo.toml |
php |
.php |
composer.json |
dart |
.dart |
pubspec.yaml |
python |
.py |
pyproject.toml |
go |
.go |
go.mod |
sql |
.sql |
none (no imports; belongs to enclosing Workspace package) |
shell |
.sh, .bash, .zsh |
none (no imports; belongs to enclosing Workspace package) |
For Go (go), each folder with a go.mod file below the repository root is one Workspace package (go.work is not read), an import of a repository Go package leads to every non-test .go file in that folder, standard library and cgo ("C") imports count as built in, every named function and method (ReceiverType.MethodName) with a body is one function, function literals inside a function count toward the enclosing function one nesting level deeper (package-level function literals are not separate functions), and decision points are if, for, case except default, &&, and ||.
Go Verbosity applies five Flagged line rules (never flagging idiomatic if err != nil checks):
else-after-return (an else after a branch chain that always returns, silent when an if short variable is used in else), if-else-returns-boolean (an if/else or if followed by return returning true and false), conditional-yields-boolean (an if/else assigning true and false to the same variable), trailing-bare-return (a bare return as the last statement of a function with no results), and redundant-break (an unlabeled break as the last statement of a switch or select case).
See the Go Reference ranges for the calibrated values and calibration provenance for the measured binary for each Metric.
See docs/guide/go.md for the full Go guide.
For SQL (sql), codeint reads every .sql file in two layers with sqlparser (ADR 0018), supports generic SQL by default plus postgresql, mysql (covering MariaDB), sqlite, and duckdb Dialects, defines 2 Flagged line rules and 32 Hazard line rules (27 statement rules and 5 schema-backed rules), builds schemas automatically from repository SQL files, and leaves import Metrics absent because SQL has no imports.
Calibrated SQL Reference ranges come from a stratified panel of 77 current public SQL repositories (ADR 0035, source codeint stratified panel of 77 SQL repositories, ADR 0035, eval/panels.json, 2026-12-02, commit 9e3f53053618): Erosion 0.0% to 91.8%, Cognitive complexity 0.0% to 90.2%, Duplication 0.0% to 90.9%, and Verbosity 0.0% to 0.0% (Import cycles is absent because SQL has no imports).
See SQL below and docs/guide/sql.md for details.
For Shell (shell), codeint reads every .sh, .bash, and .zsh file with a hand-written lexer, detects POSIX sh, Bash, or Zsh from the first-line shebang and then from the extension, measures each named function plus one <script> function for top-level commands, defines 4 Flagged line rules and 10 Hazard line rules, and leaves import Metrics absent because shell scripts have no imports.
Calibrated Shell Reference ranges come from a stratified panel of 100 current public Shell repositories (ADR 0035, source codeint stratified panel of 100 Shell repositories, ADR 0035, eval/panels.json, 2026-12-02, commit 9e3f53053618): Erosion 36.4% to 93.0%, Cognitive complexity 21.8% to 82.8%, Duplication 0.3% to 71.3%, and Verbosity 0.0% to 3.1% (Import cycles is absent because shell scripts have no imports).
See Shell below and docs/guide/shell.md for details.
{
"languages": [
{ "plugin": "typescript-javascript", "include": ["src"], "exclude": ["src/broken.ts"] }
]
}codeint checkIn a multi-language repository, list each built-in Language plugin with its own folders:
{
"languages": [
{ "plugin": "typescript-javascript", "include": ["web"], "exclude": ["web/dist"] },
{ "plugin": "rust", "include": ["crates"], "exclude": [] },
{ "plugin": "php", "include": ["app", "src"], "exclude": [] },
{ "plugin": "dart", "include": ["lib"], "exclude": [] },
{ "plugin": "python", "include": ["services"], "exclude": [] },
{ "plugin": "go", "include": ["cmd", "internal"], "exclude": [] },
{ "plugin": "sql", "include": ["db", "analytics"], "exclude": [] },
{ "plugin": "shell", "include": ["scripts"], "exclude": [] }
]
}Each entry of plugins declares an external WebAssembly component Language plugin or Metric plugin loaded from either a local path or an HTTPS url, with a required 64-character hexadecimal SHA-256 digest.
External Plugins implement codeint:plugin@0.6.0 (codeint:plugin/language@0.6.0 or codeint:plugin/metric@0.6.0).
The host also supports 0.5.0 components.
See Plugin migration.
A Plugin built for another interface version (such as 0.4.0) stops the run with exit code 2, naming the Plugin, both interface versions, and how to rebuild it.
See docs/plugins.md to build, hash, test, version, and upgrade external Plugins.
Set kind to "language" (the default) for a Language plugin, or "metric" for a Metric plugin.
Set either path or url on each entry, never both.
External Metric plugins appear alongside the built-in Metrics in codeint check, codeint diff, and codeint trend, and support budgets and regression_limits under their Metric key.
Relative paths resolve from the root of the repository.
Remote plugins require an https:// URL (plain http:// and other schemes are refused), are downloaded once into the plugins subfolder of the result cache keyed by <sha256>.wasm under a 50 MiB default download cap (override with CODEINT_PLUGIN_MAX_DOWNLOAD_MB, a positive integer in MiB up to 8796093022207), and are reused from the cache on later runs without touching the network.
codeint verifies the SHA-256 digest before caching, compiling, or instantiating the component, and grants the component no host capabilities (no file system, network, environment, or clock access).
codeint keeps each compiled Plugin in the Compiled plugin cache so later runs skip the compile.
A missing sha256, an invalid digest, a missing file, a non-HTTPS URL, or a hash mismatch stops the run with exit code 2:
{
"plugins": [
{
"name": "sample",
"kind": "language",
"path": "plugins/sample.wasm",
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
{
"name": "remote-metric",
"kind": "metric",
"url": "https://example.com/plugins/remote-metric.wasm",
"sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}
]
}codeint checkEvery WebAssembly Plugin runs under a memory cap (64 MiB by default) and a per-call time limit (5000 ms by default).
When a Language plugin hits a limit on a file, codeint skips that file and lists it under skipped, and finishes the run.
When a Metric plugin hits a limit, codeint stops the run with exit code 2 and names the Plugin.
Use plugin_limits to raise or adjust these limits:
{
"plugin_limits": {
"memory_mb": 128,
"timeout_ms": 10000
}
}codeint checkboundaries enforces directional internal zone rules, public_files encapsulation, and optional external-package rules (allow_external and deny_external) over runtime imports across every supported Language plugin.
When boundaries is omitted, boundary evaluation is completely inactive.
Set boundaries.preset to layered (presentation, application, domain, infrastructure) or hexagonal (domain, ports, application, adapters) to start from built-in zone globs and directional internal rules; built-in presets never include guessed third-party package rules.
Entries in boundaries.zones override matching preset zones or add new ones; rules in boundaries.rules with allow or deny replace preset rules for matching from zones, while rules setting only allow_external or deny_external keep the preset's internal rules intact.
Each zone in boundaries.zones declares repository-relative patterns globs and optional public_files globs naming the only files external zones may import.
When a file matches patterns in multiple zones, the most specific pattern (most literal characters, then longest pattern, then zone name alphabetically) wins.
Each rule in boundaries.rules sets from (a zone name or *), at least one of internal (allow or deny, mutually exclusive) or external (allow_external or deny_external, mutually exclusive), and an optional reason.
Internal and external directives are independent and may be combined on the same from zone; mixing allow and deny or mixing allow_external and deny_external for the same from zone stops the run with exit code 2.
allow_external and deny_external match third-party package names with globs (such as prisma or @aws-sdk/*) while always permitting standard-library built-ins, so allow_external: [] allows pure standard-library code.
When no rule sets allow_external or deny_external, resolved_imports counts resolved internal imports only; when at least one external-package rule exists, checked external imports are included in resolved_imports.
By default, boundaries evaluates the production Source set only; set source_sets to evaluate additional Source sets, and set strict_zones to true to report files matching no zone.
When strict_zones is false, the boundaries ratio divides Findings by resolved_imports; when strict_zones is true, the denominator is resolved_imports + evaluated_files so both import Findings and unzoned-file Findings sit in [0, 1] without clamping (ADR 0037).
In codeint diff, each boundary Finding carries a stable content-based identifier so pre-existing Findings are classified as unchanged while any newly introduced boundary Finding fails by default (new_findings: "any_new_finding").
See docs/guide/import-boundaries.md for walkthroughs and examples.
{
"budgets": {
"production": {
"boundaries": 0
}
},
"regression_limits": {
"boundaries": {
"ratio_rise": 0.01,
"new_findings": "any_new_finding"
},
"production": {
"boundaries": {
"ratio_rise": 0,
"new_findings": "any_new_finding"
}
}
},
"boundaries": {
"preset": "layered",
"zones": {
"app": {
"patterns": ["src/**"],
"public_files": ["src/**"]
},
"infra": {
"patterns": ["infra/**"]
}
},
"rules": [
{
"from": "app",
"allow": ["app"],
"allow_external": [],
"reason": "App layer stays independent of infrastructure and third-party packages"
},
{
"from": "infra",
"deny": ["app"],
"deny_external": ["prisma", "@aws-sdk/*"],
"reason": "Infrastructure must not import application code or forbidden SDKs"
}
],
"strict_zones": false,
"source_sets": ["production"]
}
}codeint checkcodeint compares declared manifest dependencies against imported external packages for every Workspace package that has a dependency manifest (package.json, Cargo.toml, pyproject.toml, composer.json, pubspec.yaml, or go.mod), reporting three independent Metrics:
unused_dependencies: declared runtime and dev dependencies not imported by any Production, Test, or Generated file in the owning package. Optional declarations (such aspeerDependencies,optionalDependencies, ambient@types/*packages, Cargooptional = true, Pythonoptional-dependencies, Composersuggest, and Gorequire ... // indirect) satisfy imports without being flagged as unused. In Go, a module imported only by_test.gofiles stays a runtime dependency with no Finding, and a localreplacepointing at a repository folder resolves imports to that folder's Go files. In JavaScript and TypeScript projects,devDependenciesinvoked in command position bypackage.jsonscripts(including workspace member scripts for rootdevDependencies) are credited as used while keeping theirdevclassification fordeclaredcounts anddev_in_production_dependencies.unlisted_dependencies: external packages imported by Production or Test files in a package that has a dependency manifest but does not declare them. Standard library and runtime built-ins are never flagged. In JavaScript and TypeScript workspaces, a workspace member may import dependencies hoisted in the rootpackage.json, crediting the root as used while still enforcingdev_in_production_dependenciesfor root dev dependencies imported by runtime Production files.dev_in_production_dependencies: dependencies declared only as dev dependencies (including Go modules named only bytooldirectives without a plainrequireline) that are imported by runtime Production files. Dev dependencies imported by Test files or Tooling files (files inside universal repository tooling folders.github/,scripts/,docs/,examples/,tools/, andbenches/at the repository root or a package root, plus language-specific Tooling files markedis-tooling-fileby their owning Language plugin) are treated as used and are not flagged.
For JavaScript and TypeScript, codeint excludes declarations for the same local package names that import resolution links. A nested manifest outside the declared workspaces leaves a matching external dependency declaration eligible for all three Metrics.
List canonical external package names under dependencies.ignore to exclude them from all three dependency Metrics.
Set independent Budgets under budgets.unused_dependencies, budgets.unlisted_dependencies, and budgets.dev_in_production_dependencies, and adjust codeint diff Regression limits under regression_limits (all three default to new_findings: "any_new_finding"):
{
"dependencies": {
"ignore": ["tailwindcss"]
},
"budgets": {
"unused_dependencies": 0,
"unlisted_dependencies": 0,
"dev_in_production_dependencies": 0
},
"regression_limits": {
"unused_dependencies": { "ratio_rise": 0.01, "new_findings": "any_new_finding" },
"unlisted_dependencies": { "ratio_rise": 0, "new_findings": "any_new_finding" },
"dev_in_production_dependencies": { "ratio_rise": 0, "new_findings": "any_new_finding" }
}
}codeint checkBy default, Duplication reports exact normalized Clone groups within each Language plugin and aggregates per-language measurements into the repository total so calibrated Reference ranges stay unchanged and unrelated languages never cross-match (ADR 0037).
TypeScript, JavaScript, Vue, and Svelte share one Language plugin, so clones across those files still match.
Set duplication.near_clones to true to also detect near-duplicate blocks that differ by small insertions, deletions, or edits using shingle Jaccard similarity at or above duplication.min_similarity (0.85 by default, in (0, 1]), with anchor-checked clustering and similarity-ordered LSH bucket capping.
Near-clone mode honors the same import-or-export, minimum token, and minimum distinct token rules as exact Clone groups, clusters overlapping exact and near-clone fragments across three or more locations into Clone families, and leaves Verbosity unaffected because Verbosity counts Flagged lines only (ADR 0024).
{
"duplication": {
"near_clones": true,
"min_similarity": 0.85
}
}codeint checkFile size (file_size) is the share of Production source lines that lie beyond the File size limit in their file (ADR 0041).
Ratio Metrics such as Erosion improve when a change splits complex functions into many small ones, even when the file nearly doubles; File size catches that growth.
Set the File size limit with file_size.max_source_lines, an integer from 1 to 1000000.
codeint measures File size only when that key is set, so without it reports, diffs, Budgets, the Baseline, and the Ratchet stay unchanged.
A File size Budget, new-file Budget, or Regression limit, or --budget production.file_size, without that key stops the run with exit code 2 and names both keys.
Each Production file adds its excess lines: its source lines minus the File size limit, or 0 when the file is at or below the limit.
excess_lines is the sum of excess lines over all Production files, and the ratio is excess_lines divided by all Production source lines.
A file one line over the limit adds one excess line, so crossing the limit never counts the whole file at once.
Each file with excess lines is one Oversized file Finding, listed largest excess first, with its path, source_lines, and excess_lines.
The id of an Oversized file depends on its path only, so a growing file keeps its id and a Baseline entry stays matched.
File size covers the Production Source set only.
budgets.production.file_size and new_file_budgets.production.file_size set its Budgets, and file_size under any other Source set stops the run with exit code 2.
In codeint diff, File size fails on a direct numerator rise by default (new_findings: "numerator_rise"), so a Production file that gains excess lines fails even when every ratio Metric improves.
With regression_limits.per_file: true, codeint diff also fails when one modified file gains excess lines while another file shrinks.
To adopt File size in a repository that already holds Oversized files, run codeint baseline update after you add the key, or start with a loose Budget.
In a workspace, each package under packages carries its own file_size object with ratio, excess_lines, and source_lines, and the package values add up to the Source set.
codeint diff lists new and resolved Oversized files under file_size, and codeint trend adds a File size column whenever a measured commit has a File size limit.
SARIF output holds one file_size result for each Oversized file, at line 1 of the file.
{
"file_size": {
"max_source_lines": 10
},
"budgets": {
"production": {
"file_size": 0
}
}
}codeint checkcodeint: the production file_size ratio 0.2308 is over its Budget 0
To hold new files to the File size limit and tune the Regression limits, set the keys in one configuration file:
{
"file_size": {
"max_source_lines": 1000
},
"new_file_budgets": {
"production": {
"file_size": 0
}
},
"regression_limits": {
"per_file": true,
"file_size": {
"ratio_rise": 0.01,
"new_findings": "numerator_rise"
},
"production": {
"file_size": {
"ratio_rise": 0,
"new_findings": "numerator_rise"
}
}
}
}codeint checkOrphan files detection traverses resolved runtime imports from the union of manifest-declared entry points (such as package.json, Cargo.toml, pyproject.toml, composer.json, pubspec.yaml, and Go public packages outside internal/ relative to go.mod), Production files marked as program starts by a Language plugin (such as Go files declaring package main), and configured entry_points globs in the configuration file.
Marked files in the Test, Generated, or Vendored Source sets stay out of entry points.
Production files unreachable from any Production entry point are reported as unreferenced, or as test-only when still imported by Test files.
In Python, from demo import worker reaches demo/worker.py when worker is a child module of demo.
The child module counts as a possible target even when the package exports a symbol with the same name.
For a namespace package without __init__.py, a matching child module on a supported import root counts as a local import.
When a namespace spans several import roots, codeint retains each possible child target within that namespace.
Generated and Vendored Source sets and Tooling files (files inside universal repository tooling folders .github/, scripts/, docs/, examples/, tools/, and benches/ at the repository root or a package root, plus language-specific Tooling files marked is-tooling-file by their owning Language plugin) are excluded from discovered entry-point roots and evaluated Production files.
A Tooling file stays in the Production Source set for all other Production Metrics and Hazards, and listing a Tooling file under entry_points overrides its exclusion from Orphan files so it acts as a live entry point.
When no runtime entry points exist for a language or isolated Workspace package, Orphan files reporting stays silently inactive.
In codeint diff, each Orphan files Finding carries a stable id so pre-existing orphans remain unchanged while newly introduced orphans fail by default (new_findings: "any_new_finding").
{
"entry_points": ["src/*.ts"],
"budgets": {
"production": {
"orphan_files": 0
}
},
"regression_limits": {
"orphan_files": {
"ratio_rise": 0.01,
"new_findings": "any_new_finding"
},
"production": {
"orphan_files": {
"ratio_rise": 0,
"new_findings": "any_new_finding"
}
}
}
}codeint checkTest gap (test_gap, a reserved built-in Metric key) is the share of total Production Function mass that tests do not execute.
codeint never runs tests and never guesses where a Coverage report is.
Name one or more Coverage reports in coverage_reports (paths relative to the repository root) or with the repeatable --coverage-report <PATH> option on codeint check.
When --coverage-report is present on the command line, coverage_reports from the configuration file is not used for that run.
See docs/guide/test-gap.md for copy-paste setup commands for each supported test tool.
Test gap computes from the Code model alone after codeint fills per-function coverage facts from the named reports (Metric version 2, ADR 0039):
- Each listed line in a covered file is attributed only to the innermost enclosing function span across all languages, excluding lines inside strictly nested child functions or closures from enclosing parent functions. Functions sharing identical start and end lines both retain those lines because line-based Coverage reports carry no column information.
- For each Production function,
untested_shareis its owned listed lines with hit count0divided by all its owned listed lines. Lines that no report lists count on neither side. - Test gap is the sum over Production functions of
Function mass * untested_share, divided by the total Function mass of those functions. - A function whose file appears in no named report, in a language that at least one named report covers, counts as fully untested (
untested_share = 1). - A function whose file appears in a report, but that owns no listed line after excluding strictly nested child spans, is left out of Test gap on both sides.
- When several Coverage reports (or several Cobertura
<class>entries for one file) list the same line, the line counts as executed when any of them has a hit count above0. - Test gap covers the Production Source set only (repository total, each covered language, and each Workspace package) and never appears for Test, Generated, or Vendored files.
- Test gap has no Reference range, and no Language plugin publishes one.
- With no Coverage report named, or for a language covered by no named report, Test gap is absent (never
0or1) and the report states why in one line.
codeint detects the format of each named file from its content, so the file name does not matter, and one run may mix LCOV and Cobertura XML reports:
- LCOV: reads
SF,DA, andend_of_record; ignoresTN,FN,FNDA,FNF,FNH,BRDA,BRF,BRH,LF, andLH; stops with exit code 2 on any other record, naming the file and line. - Cobertura XML: reads XML documents whose root element is
<coverage>, reading<source>roots,<class filename="...">, and<line number="..." hits="...">, while ignoring branch facts, rates, and<methods>. - Any file that does not exist, cannot be read, contains invalid UTF-8, has broken XML, or is neither LCOV nor Cobertura XML stops the run with exit code 2 and names the file (listing both LCOV and Cobertura XML when the format is not recognized).
Coverage reports are untrusted input and enforce these bounds:
- Maximum report size:
64MiB (67,108,864bytes). - Maximum Cobertura XML element nesting depth:
64. - Cobertura XML rejects
DOCTYPEdeclarations,ENTITYdeclarations, custom or external entities (only predefined XML entities and character references are allowed), and processing instructions other than the XML declaration, so a report can never read other files or make network requests. - Report paths and Cobertura
<source>roots never resolve to files outside the repository.
Path matching and stale-report checks apply identically to LCOV and Cobertura XML:
- For Cobertura XML, each
<source>root is tried as a prefix of eachfilenamebefore matching. - codeint matches each report path to a repository file by the longest matching ending, handling absolute paths, repository-relative paths, and package-relative paths.
- Every report path that matches no repository file, or matches several files equally well, is named in one unmatched-path note in the report; with no unmatched path, the note is omitted.
- A report line beyond the end of its matched file stops the run with exit code 2, naming the report, the file, and the line; a line equal to the file's line count is accepted.
{
"coverage_reports": ["coverage/lcov.info", "api/coverage.xml"],
"budgets": {
"production": {
"test_gap": 0.25
}
}
}Pass reports on the command line to override coverage_reports for a single run:
codeint check --coverage-report coverage/lcov.info --coverage-report api/coverage.xml
The built-in sql Language plugin measures .sql files in two layers with sqlparser (ADR 0018): a tokenizer layer for source lines, functions, decision points, Cognitive complexity, and Duplication, and a per-statement parser layer for Flagged line rules, Hazard line rules, and SQL schemas.
See docs/guide/sql.md for a walkthrough and monorepo examples.
- Statements and names: each top-level statement is one function spanning its first and last line.
A
CREATEstatement for aTABLE,VIEW,INDEX,FUNCTION,PROCEDURE,TRIGGER,TYPE, orMACROtakes the object's name, keeping schema prefixes; other statements have no name. - Decision points and Cognitive complexity: each
WHENarm of aCASE, eachANDandORin a condition (excludingBETWEEN ... AND, transactionAND CHAIN, andCREATE OR REPLACE), eachJOIN(includingSTRAIGHT_JOIN), each subquery ((SELECT ...)or(WITH ...)), and each set operation (UNION,INTERSECT, orEXCEPT, excluding wildcardEXCEPT) adds1; window functions andGROUP BYadd0. Inside a stored routine (function, procedure, or trigger, including PostgreSQL dollar-quoted SQL/PLpgSQL bodies, MySQLDELIMITER-delimited routines, and SQLite triggers), eachIF,ELSIF/ELSEIF, loop (WHILE,FOR,REPEAT,LOOP), and error handler (EXCEPTION,HANDLER) adds1and deepens block nesting. Cognitive complexity uses subquery depth plus routine block depth. - Dialects (
dialects.sql): map repository-relative folder or file globs topostgresql,mysql(covers MariaDB),sqlite, orduckdb. Files covered by no entry use generic SQL; ClickHouse, SQL Server, Oracle, BigQuery, and Snowflake stay generic SQL. An unknown Dialect name, an emptyincludelist, or one file matched by entries with different Dialects stops the run with exit code 2. PostgreSQLpsqlbackslash commands and DuckDB CLI dot-commands count as source lines and are not parsed as statements. - Templated SQL and file diagnostics: files containing
{{,{%,%},<%, or%>outside SQL strings and comments are skipped underskippedwith reasoncannot parse: templated SQL. A single statement that the parser rejects still counts in every token-layer Metric, receives no Flagged line or Hazard line rules, and is listed underfile_diagnosticswithpath,line,kind(rejected-statement), andmessage. - SQL Schema (
scope_summaries): built automatically in repository-relative path order fromCREATE TABLE(excludingCREATE TEMP/CREATE TEMPORARY TABLE),CREATE INDEX,ALTER TABLE,DROP TABLE, andDROP INDEXacross Production, Test, and Generated SQL (never Vendored, and skipping rollback down-migration files nameddown.sqlor ending in.down.sql), scoped per Workspace package and Dialect (plus root per Dialect; generic SQL is its own Dialect). Reports list each scope's table count underscope_summaries. The 5 schema-backed Hazard line rules stay silent when a table is unknown or an unqualified column is ambiguous. - Flagged line rules (Verbosity):
or-chain-collapses-to-in: three or moreORequality comparisons of the same column against constant literals.having-without-aggregate: aHAVINGcondition that contains no aggregate function (excluding implicit aggregate groups withoutGROUP BY).
- Reference ranges: calibrated across a stratified panel of 77 current public SQL repositories (ADR 0035, source
codeint stratified panel of 77 SQL repositories, ADR 0035, eval/panels.json, 2026-12-02, commit 9e3f53053618): Erosion0.0% to 91.8%, Cognitive complexity0.0% to 90.2%, Duplication0.0% to 90.9%, and Verbosity0.0% to 0.0%(Import cycles is absent).
All 32 built-in SQL Hazard line rules (27 statement rules and 5 schema-backed rules):
| Rule | Kind | Matches |
|---|---|---|
select-star |
statement | SELECT * or SELECT t.* (outside direct EXISTS subqueries) |
leading-wildcard-like |
statement | LIKE or ILIKE string literal starting with % or _ |
large-offset |
statement | OFFSET constant above 1,000 |
tables-without-join-condition |
statement | Non-lateral CROSS JOIN, a join without a constraint, or multiple non-lateral FROM tables with no linking condition |
distinct-with-order-by |
statement | SELECT DISTINCT paired with ORDER BY |
subquery-in-select-list |
statement | A subquery inside a SELECT projection expression |
function-on-filter-column |
statement | A function call (or TRIM/SUBSTRING/EXTRACT/CEIL/FLOOR/POSITION/OVERLAY) applied to a column in a filter (excluding aggregates in HAVING) |
not-in-subquery |
statement | NOT IN with a subquery |
union-without-all |
statement | UNION without ALL |
select-without-filter-or-limit |
statement | SELECT from a table with no WHERE/PREWHERE and no LIMIT/FETCH/TOP (outside CREATE VIEW) |
count-without-filter |
statement | COUNT(*) from a table with no WHERE/PREWHERE and no FILTER clause (outside CREATE VIEW) |
order-by-random |
statement | ORDER BY calling RANDOM(), RAND(), NEWID(), or GEN_RANDOM_UUID() |
distinct-over-join |
statement | DISTINCT over two or more joined tables (excluding DISTINCT ON) |
table-read-twice |
statement | The same non-CTE table read more than once in one statement |
subquery-refers-to-outer-table |
statement | A correlated subquery referencing a table or alias from an outer scope |
long-in-list |
statement | An IN list with more than 100 items |
deep-subquery-nesting |
statement | Subqueries nested three levels or more |
join-without-aliases |
statement | A join of two or more tables where at least one table lacks an alias |
column-position |
statement | An integer column position in ORDER BY or GROUP BY |
update-without-filter |
statement | UPDATE with no WHERE clause and no filtering INNER JOIN |
delete-without-filter |
statement | DELETE with no WHERE clause and no filtering INNER JOIN |
truncate |
statement | TRUNCATE statement |
drop |
statement | DROP statement for any object |
grant-or-revoke |
statement | GRANT or REVOKE statement |
always-true-condition |
statement | A tautological filter condition such as OR 1 = 1, TRUE, or NOT FALSE (excluding LEFT [OUTER] JOIN ... ON TRUE and INSERT ... SELECT ... WHERE TRUE ON CONFLICT) |
sql-built-at-run-time |
statement | Dynamic SQL execution such as EXECUTE IMMEDIATE, EXECUTE '...', or sp_executesql |
plain-text-secret |
statement | A non-empty string literal in a password/secret clause, or written to a column whose name contains password, passwd, pwd, secret, token, api_key, apikey, private_key, or access_key |
filter-on-unindexed-column |
schema | A filter condition on a known table's column not covered by its primary key, index prefix, or a leading indexed column in the same AND chain |
order-by-unindexed-column |
schema | An ORDER BY on a known table's column not covered by its primary key or composite index prefix (excluding aggregates and CASE in grouped queries) |
join-on-unindexed-column |
schema | A join condition (ON or USING) on a known table's column not covered by its primary key, index prefix, or a leading indexed column in the same AND chain |
unknown-column |
schema | A reference or assignment to a column not present on a known table in the built schema |
text-compared-to-number |
schema | A text-typed column in a known table compared to a bare numeric literal |
{
"dialects": {
"sql": [
{
"dialect": "postgresql",
"include": ["db/postgres"]
},
{
"dialect": "duckdb",
"include": ["analytics"]
}
]
}
}codeint checkThe built-in shell Language plugin measures .sh, .bash, and .zsh files with a hand-written lexer and no external parser dependency.
codeint dispatches files by extension, so extensionless scripts are not measured.
See docs/guide/shell.md for a walkthrough.
- Flavors: a first-line shebang naming
sh,dash, orashselects POSIXsh, one namingbashselects Bash, and one namingzshselects Zsh, directly or throughenv. Without a recognized shebang,.bashselects Bash,.zshselects Zsh, and.shselects POSIXsh. - Functions and names: each
name() { ... }andfunction name { ... }definition is one function with its own name. Commands outside named functions form one function named<script>when any exist. - Decision points and Cognitive complexity:
if,elif,for,while,until,select, eachcasebranch except a lone*)wildcard,&&, and||each add1; Cognitive complexity adds nesting depth for nested control flow. - Source lines: comments and blank lines are not source lines; single-quoted, double-quoted, and ANSI-C
$'...'strings, nested$(...)substitutions, heredocs (<<EOF,<<-EOF,<<'EOF'), and line continuations are read as code. An unterminated quote, substitution, or heredoc makes the file unparsable. - No imports: Import cycles, Import boundaries, Orphan files, and Dependency hygiene are absent for shell scripts.
- Flagged line rules (Verbosity):
useless-cat:cat file | commandwith exactly one plain file operand.legacy-backticks: command substitution written with backticks instead of$(...).redundant-exit-status-check: a[ ... ],[[ ... ]], ortestcomparison of$?with0.else-after-return: anelseafter anifbranch that always ends inreturnorexit.
- Reference ranges: Erosion
36.4% to 93.0%, Cognitive complexity21.8% to 82.8%, Duplication0.3% to 71.3%, and Verbosity0.0% to 3.1%from a stratified panel of 100 current public Shell repositories (ADR 0035).
All 10 built-in Shell Hazard line rules:
| Rule | Matches |
|---|---|
missing-strict-mode |
A script with top-level commands but no set -e and set -u (POSIX sh), or no set -e, set -u, and set -o pipefail (Bash and Zsh), from set, Zsh setopt, or shebang flags |
unquoted-variable |
An unquoted $VAR or ${VAR} expansion in a command name, argument, or redirection target |
eval-with-variable |
eval with an argument that expands a variable |
pipe-download-to-shell |
curl or wget piped into a shell interpreter, or a shell reading <(curl ...) or <(wget ...) |
unchecked-cd |
cd outside a condition and not followed by && or ||, in a script without set -e |
unguarded-rm-rf |
Recursive forced rm on a path that starts with $VAR/ or ${VAR}/ without a ${VAR:?} guard |
hardcoded-secret |
A non-placeholder literal assigned to a name containing password, passwd, secret, token, api_key, apikey, private_key, access_key, or a similar word, or a literal with a known secret shape such as an AWS access key, a ghp_ token, or a private key block |
read-without-r |
read without -r |
posix-sh-bashism |
Bash-only syntax in a POSIX sh script: [[, declare, function, mapfile, readarray, select, shopt, source, typeset, ((, array assignment, <<<, |&, &>, &>>, or process substitution |
insecure-tls-download |
curl -k, curl --insecure, or wget --no-check-certificate |
Hazards (hazards, a reserved built-in Metric key) is the share of source lines that are Hazard lines (hazard_lines / source_lines), sitting next to Software entropy (ADR 0016).
See docs/guide/hazards.md for the full guide.
- Absent when no rules exist: for languages whose Language plugin defines no Hazard line rules (
typescript-javascript,rust,php,dart,python, andgo), Hazards is absent (never0). Repository totals count only files of languages with Hazard line rules on both numerator and denominator. - Equal weight and AST-only: every Hazard line carries equal weight with no severity levels, and every rule matches parsed statements rather than raw text. A line matching several rules counts as one Hazard line and produces one Finding per rule.
- Strict non-leakage: a Hazard line Finding holds only
id,path,line,rule, and optionalowners; no report format, log line, or error message prints the matched source text. - Disabling rules (
hazards.disabled_rules): list rule names to turn off across the repository. A turned-off rule adds no Hazard line and no Finding on either side ofcodeint diff; an unknown rule name stops the run with exit code 2 and names it. - Budgets and Regression limits:
budgets.{source_set}.hazardsaccepts a number from0to1and passes when Hazards is absent.regression_limits.hazardsandregression_limits.{source_set}.hazardsacceptratio_rise(default0.01) andnew_findings(defaultany_new_finding, plus numerator rise where the numerator ishazard_lines). - No Reference range: Hazards has no published Reference range.
{
"hazards": {
"disabled_rules": ["select-star"]
},
"budgets": {
"production": {
"hazards": 0.05
}
},
"regression_limits": {
"hazards": {
"ratio_rise": 0.01,
"new_findings": "any_new_finding"
},
"production": {
"hazards": {
"ratio_rise": 0,
"new_findings": "any_new_finding"
}
}
}
}codeint checkA Framework profile is a package-level rule set inside a Language plugin that adds framework detection, convention entry points, framework-generated Source set paths, fallback import hints, and optional Reference ranges while keeping per-file lowering framework-blind (ADR 0025).
typescript-javascript ships built-in Framework profiles for react, vue2, vue3, svelte, nextjs, nuxt, sveltekit, angular, and nestjs, php ships laravel, symfony, cakephp, and codeigniter, python ships django, fastapi, and flask, dart ships flutter, and external WebAssembly Language plugins may expose their own Framework profiles through codeint:plugin@0.6.0.
Active Framework profile names appear under framework_profiles per language and per Workspace package in TOON, JSON, Markdown, and text reports (omitted when none are active).
- Automatic detection (default): each Workspace package resolves Framework profiles strictly from its own local manifest and files; a monorepo root manifest never activates a profile on a child package without a local signal, and
peerDependencies-only UI libraries do not activate app-only conventions (svelte,sveltekit, andnuxtallowdevDependencies). - Global override (
framework_profiles): setfalseto disable all profiles,trueto use automatic detection, a list of profile names (or{"only": [...]}) to activate only those profiles, or{"exclude": [...]}to exclude named profiles. - Per-package override (
packages.<path>.framework_profiles): overrideframework_profilesfor one Workspace package keyed by its repository-relative root (or"."for the repository root). - Fail-fast validation: every configured profile name is validated against the union of
known_framework_profiles()across all loaded Language plugins; an unknown name stops the run with exit code 2. - Disabling import hints: disabling a profile also disables its fallback import hints during import resolution.
{
"framework_profiles": { "exclude": ["svelte"] },
"packages": {
".": { "framework_profiles": false }
}
}codeint checkA Ratchet file (.codeint/ratchet.json by default, or ratchet.path in configuration) stores each measured Metric's ceiling ratio (rounded to 4 decimal places) alongside its positive integer Metric version across per-Source-set Metrics, Dependency hygiene, Production Test gap when coverage_reports are configured, and loaded external Metric plugins (ADR 0026).
When the Ratchet file exists, whole-repository codeint check and codeint diff enforce it automatically, failing with exit code 1 (over_ratchet) if any measured Metric rises above its recorded ceiling and failing with exit code 2 on any Metric version mismatch while naming codeint ratchet update.
Single-package runs (--package) skip Ratchet enforcement and emit a ratchet_note explaining why.
Paths escaping the repository (absolute paths, .. traversal, or escaping symlinks) stop the run with exit code 2.
{
"ratchet": {
"path": ".codeint/ratchet.json"
}
}codeint ratchet updateWhen a Language plugin reports that one manifest is invalid, such as an empty go.mod or a pyproject.toml that is not valid TOML, codeint check, codeint diff, codeint trend, the MCP check and diff tools, and the other measuring commands skip that manifest and measure the rest.
codeint asks the plugin again for the Workspace packages without the invalid manifest, and repeats this for each further invalid manifest.
Files under a skipped manifest count toward the surrounding Workspace package, as if the manifest did not exist.
A skipped manifest is also left out of dependency, import, and entry-point resolution.
Each skipped manifest adds one entry to manifest_warnings in JSON and TOON reports of codeint check, and one line in Markdown reports.
codeint diff keeps the two sides apart: manifest_warnings.base lists the manifests skipped in the base commit, and manifest_warnings.head lists those skipped in the head, so a manifest that you fixed in the head still shows as a base warning.
The Markdown report of codeint diff prefixes each line with Base commit: or Head commit:.
codeint trend lists the warnings of each commit that skipped a manifest under manifest_warnings, as entries with the commit and its warnings, and prefixes each Markdown line with Commit {id}:.
codeint writes each warning on one line and escapes control characters in it, such as ESC, as \u{1b}:
Skipped the invalid go manifest internal/warpc/genwebp/go.mod: missing module directive. Files under it count toward the surrounding Workspace package.
A warning never changes the exit code by itself.
codeint check --package {folder} names the skipped manifest and the plugin's reason when {folder} holds a skipped manifest, because the manifest never made that folder a Workspace package.
codeint doctor reports the workspace check as warn and lists each skipped manifest.
A plugin trap, an error that names a path codeint did not pass, and an error that is not about a manifest still stop the run with exit code 2.
codeint caches the measurement of each commit it reads from Git objects, so a second codeint diff against the same base reads it back instead of measuring the commit again.
That covers the merge-base, the head ref of --head, and each commit of codeint trend.
An entry keys on one commit and the settings that shape its measurement.
Those settings are the codeint version, Plugin interface version, all Metric versions, all Language plugin versions, and the configuration file.
See ADR 0046 for the Metric versions changed by the Composer and package resolution fixes.
Any change to the configuration file other than $schema or format, or any Metric version bump, measures again.
Changing local working-tree Coverage reports never invalidates cached historical commits.
The working tree is never cached, because it has no commit.
The cache lives in the codeint folder of your user cache folder:
| Platform | Folder |
|---|---|
| Linux and macOS | $XDG_CACHE_HOME/codeint, or ~/.cache/codeint when XDG_CACHE_HOME is unset, empty, or relative |
| Windows | %LOCALAPPDATA%\codeint |
Set CODEINT_CACHE_DIR to use another folder; a relative path starts at the current folder:
CODEINT_CACHE_DIR=.cache/codeint codeint trendWithout any of these variables, codeint runs without a cache.
You can delete the cache files to force codeint to measure again.
In a shared folder, codeint only prunes files with its reserved result cache names, beginning with codeint-result- or .codeint-result-writing-.
codeint can still read older results with unprefixed names but never prunes those files because other tools can use the same names.
codeint prunes entries untouched for more than 30 days.
When more than 5,000 entries accumulate, it evicts the oldest-touched entries.
codeint ignores an entry it cannot read or parse and writes it again.
When it cannot write an entry, it prints a warning to standard error and the run still succeeds:
codeint: cannot write the cache entry /home/me/.cache/codeint: File exists (os error 17); the next run measures commit b4e728dff30ac8b8e4967849530b9322716748c4 again
codeint also keeps each external WebAssembly Plugin it compiles in the plugins-compiled subfolder of the result cache folder.
The next codeint check, codeint diff, codeint trend, or codeint plugin test that loads the same Plugin reads it from there instead of compiling it again.
An entry keys on the Plugin's bytes, the compiler settings, and the version of wasmtime, the WebAssembly runtime inside codeint, so a rebuilt Plugin or a new codeint release compiles again.
codeint still checks each Plugin's SHA-256 digest against codeint.json before it compiles the Plugin or reads the cache.
An entry that cannot be read or loaded costs only a fresh compile, and concurrent runs share the folder safely.
codeint doctor never writes to it.
wasmtime, not codeint, removes old entries from this folder, and it never warns when it cannot write one.
The cache holds native machine code that codeint runs outside the WebAssembly sandbox.
Anyone who can write to the folder can make codeint run code as you, so keep it as private as your home folder.
Set CODEINT_NO_PLUGIN_COMPILE_CACHE to any non-empty value to turn the Compiled plugin cache off; codeint then compiles every Plugin in memory on every run:
CODEINT_NO_PLUGIN_COMPILE_CACHE=1 codeint checkEvery command that prints a report takes --format and --output {file}.
--output writes the report in the chosen format to a file instead of standard output.
codeint check, codeint diff, and codeint report print TOON by default (or the configured format in the configuration file), and also print Text, JSON, SARIF, and Markdown.
codeint trend prints TOON by default (or the configured format in the configuration file), and also prints Text, JSON, and Markdown.
--format text prints a concise, monochrome, summary-first report without ANSI color codes.
On codeint check and codeint report, it lists the PASS/FAIL status header, aligned per-Source-set Metric tables, per-language summaries when multiple languages are measured, failing Workspace packages (or all with --all), up to 5 worst Findings per non-zero Metric (all with --all), and concise notes.
On codeint diff, it lists the PASS/FAIL header, aligned comparison tables, new Findings, and resolved Findings only under --all.
On codeint trend, it prints an aligned per-Source-set commit table with short 7-character commit hashes, oldest first.
codeint check --format textcodeint check: PASS (4 files, 39 source lines)
Production (4 files, 39 lines)
Metric Ratio Reference Status
Erosion 0.7986 0.187-0.671 ok
Cognitive complexity 0 0.121-0.532 ok
Duplication 0 0.018-0.252 ok
Verbosity 0.0256 0-0.002 ok
Import cycles 0 0-0.182 ok
Production Erosion findings (1):
src/route.ts:1 route cc=16 lines=18 mass=67.8823
Production Verbosity findings (1):
src/sign.ts:4 else-after-return
Notes
Test gap is not measured because no Coverage report was named.
skipped (1): src/broken.ts (cannot parse: Unexpected token at line 1, column 23)
declaration-only: 1 file
--format toon prints TOON, a compact text form of the JSON report with the same fields and values.
It is the default, so these commands print the same reports as they print without --format:
codeint check --format toon
codeint diff main --head feature --format toon
codeint trend --format toonThe output of codeint check above is a TOON report.
--format json prints one JSON object with the same fields and values as the TOON report.
Tools can build on this shape: the compatibility rule says how it may change.
JSON Schemas for codeint check live in schema/codeint-report.schema.json, and schemas for the other 16 JSON report commands live in schema/reports/*.schema.json (see docs/programmatic.md).
codeint check --format json{
"files": 4,
"source_lines": 39,
"source_sets": {
"production": {
"files": 4,
"source_lines": 39,
"erosion": {
"ratio": 0.7986,
"metric_version": 2,
"reference_range": {
"low": 0.187,
"high": 0.671,
"source": "codeint stratified panel of 100 TypeScript and JavaScript repositories, ADR 0035, eval/panels.json, 2026-12-02, commit 9e3f53053618"
},
"eroded_function_mass": 67.8823,
"total_function_mass": 85.0032,
"findings": [
{
"id": "f0740d06c0975d68",
"path": "src/route.ts",
"line": 1,
"end_line": 18,
"name": "route",
"cyclomatic_complexity": 16,
"cognitive_complexity": 15,
"source_lines": 18,
"function_mass": 67.8823
}
]
},
"cognitive_complexity": {
"ratio": 0.0,
"metric_version": 2,
"reference_range": {
"low": 0.121,
"high": 0.532,
"source": "codeint stratified panel of 100 TypeScript and JavaScript repositories, ADR 0035, eval/panels.json, 2026-12-02, commit 9e3f53053618"
},
"complex_cognitive_complexity": 0,
"total_cognitive_complexity": 20,
"findings": []
},
"duplication": {
"ratio": 0.0,
"metric_version": 3,
"reference_range": {
"low": 0.018,
"high": 0.252,
"source": "codeint stratified panel of 100 TypeScript and JavaScript repositories, ADR 0035, eval/panels.json, 2026-12-02, commit 9e3f53053618"
},
"clone_lines": 0,
"clone_groups": []
},
"verbosity": {
"ratio": 0.0256,
"metric_version": 4,
"reference_range": {
"low": 0.0,
"high": 0.002,
"source": "codeint stratified panel of 100 TypeScript and JavaScript repositories, ADR 0035, eval/panels.json, 2026-12-02, commit 9e3f53053618"
},
"verbose_lines": 1,
"flagged_lines": 1,
"findings": [
{
"id": "2a57800b29941394",
"path": "src/sign.ts",
"line": 4,
"rule": "else-after-return"
}
]
},
"import_cycles": {
"ratio": 0.0,
"metric_version": 3,
"reference_range": {
"low": 0.0,
"high": 0.182,
"source": "codeint stratified panel of 100 TypeScript and JavaScript repositories, ADR 0035, eval/panels.json, 2026-12-03, commit 2887c2d69196"
},
"modules_in_import_cycles": 0,
"modules": 4,
"findings": [],
"unresolved_imports": {
"count": 0,
"imports": []
}
}
}
},
"test_gap_note": "Test gap is not measured because no Coverage report was named.",
"skipped": [
{
"path": "src/broken.ts",
"reason": "cannot parse: Unexpected token at line 1, column 23"
}
],
"declaration_only": [
"src/types.d.ts"
]
}The top-level object has these fields:
| Field | Type | Meaning |
|---|---|---|
files |
integer | Number of measured source files, in every Source set |
source_lines |
integer | Source lines of the measured files; blank and comment-only lines do not count |
import_metrics_note |
string, optional | One line explaining why import Metrics are absent when the measured language has no imports |
test_gap_note |
string, optional | One line explaining why Test gap is absent when no Coverage report covers the measured code |
coverage_unmatched_note |
string, optional | One note naming every Coverage report path that matched no repository file or matched several files equally well |
manifest_warnings |
array of strings, optional | One warning for each invalid manifest that codeint skipped, naming the manifest path and the Language plugin's reason |
source_sets |
object | One section per Source set, under the keys production, test, generated, and vendored |
dependencies |
object, optional | Dependency hygiene Metrics (unused_dependencies, unlisted_dependencies, and dev_in_production_dependencies) when manifests are present for a language with imports |
languages |
object, optional | One section per Language plugin, under its name, when files of two or more Language plugins were measured; each section has files, source_lines, source_sets, and optional import_metrics_note, test_gap_note, and dependencies for that plugin's files |
skipped |
array, optional | Files that codeint could not measure, each with its path and the reason (such as cannot parse: templated SQL) |
file_diagnostics |
array, optional | Non-fatal per-file diagnostics emitted while lowering source files (such as unparsed SQL statements), each with path, line, kind, and message |
scope_summaries |
array, optional | Language-neutral summaries emitted by cross-file scope analysis per Workspace package (optional package, omitted for root) and optional dialect, each with language, kind, and fields |
declaration_only |
array of strings, optional | Paths of files that hold only type declarations and add no source lines |
over_budget |
array, optional | Metrics over their Budget, each with its source_set, metric, the ratio as the report shows it, and the budget |
A Source set section has files and source_lines for that Source set, and one object per measured Metric: erosion, cognitive_complexity, duplication, verbosity, (in production when covered by a Coverage report) test_gap, (when at least one measured language defines Hazard line rules) hazards, and (for languages with imports) import_cycles, boundaries, and orphan_files.
Each Metric object has these fields:
ratio: the Metric value, a number from 0 to 1, rounded to four decimal places.metric_version: positive integer Metric version identifying the calculation rules of this Metric (codeint diffincludesmetric_versionon each Metric change object, andcodeint trendincludes a top-levelmetric_versionsmap).reference_range: either an object withlow,high, andsource, or a string that says why no Reference range is shown. The top-level Source sets show a Reference range only when one Language plugin measured every file; a section underlanguagesalways shows its own plugin's ranges.test_gap,file_size, andhazardshave no published Reference range.- The counts behind the ratio:
eroded_function_massandtotal_function_massfor Erosion,complex_cognitive_complexityandtotal_cognitive_complexityfor Cognitive complexity,untested_function_massandtotal_function_massfor Test gap,clone_linesfor Duplication,verbose_linesfor Verbosity,hazard_linesandsource_linesfor Hazards,excess_linesandsource_linesfor File size, andmodules_in_import_cyclesandmodulesfor Import cycles. Duplication and Verbosity divide by thesource_linesof the Source set; Hazards divides by thesource_linesof languages with Hazard line rules in that Source set. Verbosity reports bothverbose_linesandflagged_lines, equal to the distinct Flagged lines in that Source set (independent of Duplication, ADR 0024). - The Findings, worst first:
clone_groupsfor Duplication, andfindingsfor every other Metric. near_clones, optional onduplication: present withmin_similaritywhen near-clone detection is enabled in the configuration file; Duplication'sreference_rangethen notes that Reference ranges are calibrated for exact Clone groups.clone_families, optional onduplication: unified Clone families when overlapping or transitively related Clone groups span three or more locations, ordered worst-first byduplicated_lines, withclone_families_left_outwhen truncated without--all, andunlisted_clone_family_group_idswhen listedclone_groupsbelong to unlisted Clone families.findings_left_out, optional: how many Findings the list leaves out;--alllists every Finding.baselined_findings, optional: how many Findings of the Metric the Baseline hides.
import_cycles also has unresolved_imports: the runtime imports that the Language plugin could not resolve, so no Import cycle passes through them.
It has count, the list imports, and the optional imports_left_out.
Each import has importer, the path of the importing file, specifier, the text of the import, and reason.
For a language with no imports, TOON and JSON reports omit import_cycles, orphan_files, boundaries, and dependencies (unused_dependencies, unlisted_dependencies, and dev_in_production_dependencies) from that language's section and its Workspace package entries.
Those six Metrics are absent rather than 0.
The section includes import_metrics_note as a single line stating that the language has no imports.
In a multi-language repository, the repository totals for import_cycles, orphan_files, boundaries, and dependencies (including Workspace package entries and Budget checks) count only files and manifests of languages with imports on both sides of each ratio.
When every measured language has no imports, those repository totals are absent, import_metrics_note is included at the top level, and Budgets on those Metrics do not fail.
Each Finding is an object with an id, followed by fields that depend on its kind:
- An eroded function has
path,line,end_line, optionalname(omitted for anonymous closures),cyclomatic_complexity,cognitive_complexity,source_lines, andfunction_mass. - A complex function (Cognitive complexity) has
path,line,end_line, optionalname(omitted for anonymous closures),cognitive_complexity,cyclomatic_complexity, andsource_lines. - A Test gap Finding has
path,line,end_line, optionalname(omitted for anonymous closures),function_mass,untested_share, and optionalowners; Findings are ordered byfunction_mass * untested_share, largest first, and fully tested functions produce no Finding. - A Clone group has
tokens, optionalsimilarity(present on near-clone Findings as a ratio in(0, 1]), andlocations; each location haspath,start_line, andend_line. - A Clone family has
duplicated_lines(unique source lines across the family without double-counting overlaps),clone_group_ids, and canonicallocationsordered bypaththenstart_line. - A Flagged line has
path,line, andrule. - A Hazard line has
path,line,rule, and optionalowners, and never includes source text. - An Import cycle has
modules, the paths of the modules in the cycle. - An Import boundary Finding has
kind(zone_rule,external_package,public_files, orunzoned_file),importer,message, optionaltarget(internal target path), optionalexternal_package(canonical third-party package name forexternal_packageFindings), optionalspecifier, optionalsource_zone, optionaltarget_zone, optionalreason, and optionalowners.
The id of a Finding is a string of 16 lowercase hexadecimal digits.
It comes from the Metric, the file or files of the Finding, and their content, never from a line number, so it stays the same when a Finding moves within its file.
It is the same in every run and on every operating system, and CRLF line endings do not change it.
Two Findings with the same content in one file get different ids, numbered in the order they appear.
The content behind the id of each kind:
- An eroded, complex, or untested (Test gap) function: every token from its first line to its last line, so a change to the function's code gives it a new
id; whitespace and comments do not count. - A Clone group: the token sequence that its copies share, with every name and every literal value treated alike, and the path of each copy.
- A Clone family: the sorted normalized token sequences of its constituent Clone groups and the canonical path of each member location.
- A Flagged line or Hazard line: the rule and the tokens of the line.
- An Import cycle: the paths of its modules.
Every path is relative to the root of the Git repository and uses / as the separator.
Line numbers start at 1.
An optional field is left out when it has no content: a Source set without files, an empty skipped, file_diagnostics, scope_summaries, declaration_only, or over_budget list, hazards when no measured language defines Hazard line rules, import Metrics for a language with no imports, findings_left_out when no Finding is left out, baselined_findings when the Baseline hides no Finding of the Metric, and baseline when .codeint/baseline.json is absent or --ignore-baseline is passed.
Later versions of codeint change the JSON report only in ways that keep existing readers working:
- They only add fields, and never rename or remove a field.
- A field keeps its type and its meaning, including its unit and its scale.
- A field that is always present stays always present.
- They may add a Source set key, a Metric object, or a kind of Finding.
Readers ignore fields they do not know, and treat a missing optional field as empty.
--format sarif prints a SARIF 2.1.0 log, so code scanning tools such as GitHub code scanning show each Finding as an annotation.
The log has one run, and the run has one result per Finding of the report.
It takes the Findings from the total, never from the sections under languages, so a Finding appears once.
For a language with no imports, the log holds no Import cycle, Import boundary, Orphan file, or Dependency hygiene Finding for files of that language.
--all and --output work as they do for every other format: without --all, the log holds the 20 worst Findings per Metric and Source set.
codeint check --format sarif{
"$schema": "https://docs.oasis-open.org/sarif/sarif/v2.1.0/errata01/os/schemas/sarif-schema-2.1.0.json",
"version": "2.1.0",
"runs": [
{
"tool": {
"driver": {
"name": "codeint",
"version": "0.10.5",
"informationUri": "https://github.com/avidianity/codeint",
"rules": [
{
"id": "erosion",
"name": "Erosion",
"shortDescription": {
"text": "A function with cyclomatic complexity over 10"
},
"fullDescription": {
"text": "Erosion is the share of total Function mass held by functions whose cyclomatic complexity is greater than 10. Function mass is cyclomatic complexity times the square root of source lines."
},
"help": {
"text": "Split the function into smaller functions, each with a cyclomatic complexity of 10 or less."
}
},
{
"id": "duplication",
"name": "Duplication",
"shortDescription": {
"text": "A Clone group: code fragments with the same token sequence"
},
"fullDescription": {
"text": "Duplication is the share of source lines that belong to at least one Clone group. A Clone group is two or more code fragments with the same token sequence once identifiers and literals are normalized."
},
"help": {
"text": "Extract the fragments of the Clone group into one shared function or module."
}
},
{
"id": "verbosity",
"name": "Verbosity",
"shortDescription": {
"text": "A Flagged line: code that can be deleted or collapsed"
},
"fullDescription": {
"text": "Verbosity is the share of source lines that are Flagged lines. A Flagged line matches a verbose-code pattern of the source language, and the result names the rule it matches."
},
"help": {
"text": "Delete or collapse the line as its rule describes; the behavior stays the same."
}
},
{
"id": "import_cycles",
"name": "Import cycles",
"shortDescription": {
"text": "An Import cycle among runtime imports"
},
"fullDescription": {
"text": "Import cycles is the share of modules that belong to at least one Import cycle. An Import cycle is a group of modules in which every module can reach every other module through runtime imports."
},
"help": {
"text": "Break the Import cycle, for example by moving the code that the modules share into a module that imports none of them."
}
},
{
"id": "cognitive_complexity",
"name": "Cognitive complexity",
"shortDescription": {
"text": "A function with cognitive complexity over 15"
},
"fullDescription": {
"text": "Cognitive complexity is the share of total cognitive complexity held by functions whose cognitive complexity is greater than 15. Cognitive complexity weights control-flow structures by nesting depth."
},
"help": {
"text": "Flatten nested control flow or split the function into smaller functions, each with a cognitive complexity of 15 or less."
}
}
]
}
},
"originalUriBaseIds": {
"SRCROOT": {
"description": {
"text": "The root of the Git repository"
}
}
},
"results": [
{
"ruleId": "erosion",
"ruleIndex": 0,
"level": "note",
"message": {
"text": "Eroded function route: cyclomatic complexity 16, over 10; 18 source lines; Function mass 67.8823."
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "src/route.ts",
"uriBaseId": "SRCROOT"
},
"region": {
"startLine": 1
}
}
}
],
"partialFingerprints": {
"codeintFindingId": "f0740d06c0975d68"
},
"properties": {
"sourceSet": "production"
}
},
{
"ruleId": "verbosity",
"ruleIndex": 2,
"level": "note",
"message": {
"text": "Flagged line: rule else-after-return."
},
"locations": [
{
"physicalLocation": {
"artifactLocation": {
"uri": "src/sign.ts",
"uriBaseId": "SRCROOT"
},
"region": {
"startLine": 4
}
}
}
],
"partialFingerprints": {
"codeintFindingId": "2a57800b29941394"
},
"properties": {
"sourceSet": "production"
}
}
]
}
]
}The tool lists one rule per Metric, and each result names its Metric in ruleId:
ruleId |
Finding | Location |
|---|---|---|
erosion |
An eroded function | The line where the function starts |
cognitive_complexity |
A function with cognitive complexity over 15 | The line where the function starts |
test_gap |
An untested or partly tested Production function | The line where the function starts; the message names the Function mass and the untested share (omitted when Test gap is absent) |
file_size |
An Oversized file | Line 1 of the file; the message names its source lines, its excess lines, and the File size limit (omitted when File size is absent) |
duplication |
A Clone group or Clone family | The first fragment or canonical location, from its start line to its end line; the other fragments or locations are related locations |
verbosity |
A Flagged line | The line; the message names the Flagged-line rule |
<hazard-rule> |
A Hazard line | The line; one SARIF rule per matched Hazard line rule name; the message is Hazard line: rule <rule>. and never prints source text |
import_cycles |
An Import cycle | Line 1 of the first module; the other modules are related locations |
Each result has the level note, and its properties.sourceSet names its Source set: production, test, generated, or vendored.
Each uri is the path that the other formats print, relative to the root of the Git repository, with / as the separator.
A character that a URI cannot hold, such as a space, is percent-encoded: src/my sign.ts becomes src/my%20sign.ts.
uriBaseId is SRCROOT, the root of the Git repository; the log does not print its absolute path, so the log is the same on every machine.
--format markdown prints a report to paste into a pull request comment.
It starts with one table: each Metric's value per Source set, the counts behind the value, and the Reference range.
Next come each Metric over its Budget and a table of the ratios of each workspace package, when there are any.
When files of two or more Language plugins were measured, a section per Language plugin follows, with that plugin's Metric table and workspace package table.
For a language with no imports, the report omits the six import Metrics and prints the one-line reason.
For Test gap, the report shows Production totals (repository, per language, and per Workspace package), lists Test gap Findings heaviest untested Function mass first under Production Findings, or prints the one-line absent reason when no Coverage report applies.
When languages emit scope summaries, per-file diagnostics, or Hazard line rules (such as SQL), the report also includes Hazards rows and Findings tables (showing Path, Line, and Rule, never source text), ## Scope summaries before the Source set Findings sections, and ## File diagnostics before ## Files not measured.
Then it lists the Findings of each Source set, worst first, and last the files that codeint did not measure.
It lists at most 20 Findings per Metric, so the comment stays short; --all lists every Finding.
codeint check --format markdown# codeint report
codeint measured 4 files with 39 source lines.
Test gap is not measured because no Coverage report was named.
| Source set | Metric | Value | Behind the value | Reference range |
| ---------- | ------ | ----- | ---------------- | --------------- |
| Production | Erosion | 0.7986 | 67.8823 of 85.0032 Function mass in eroded functions | 0.187 to 0.671, source: codeint stratified panel of 100 TypeScript and JavaScript repositories, ADR 0035, eval/panels.json, 2026-12-02, commit 9e3f53053618 |
| Production | Cognitive complexity | 0 | 0 of 20 cognitive complexity in functions over 15 | 0.121 to 0.532, source: codeint stratified panel of 100 TypeScript and JavaScript repositories, ADR 0035, eval/panels.json, 2026-12-02, commit 9e3f53053618 |
| Production | Duplication | 0 | 0 clone lines of 39 source lines | 0.018 to 0.252, source: codeint stratified panel of 100 TypeScript and JavaScript repositories, ADR 0035, eval/panels.json, 2026-12-02, commit 9e3f53053618 |
| Production | Verbosity | 0.0256 | 1 Flagged line of 39 source lines | 0 to 0.002, source: codeint stratified panel of 100 TypeScript and JavaScript repositories, ADR 0035, eval/panels.json, 2026-12-02, commit 9e3f53053618 |
| Production | Import cycles | 0 | 0 of 4 modules in an Import cycle | 0 to 0.182, source: codeint stratified panel of 100 TypeScript and JavaScript repositories, ADR 0035, eval/panels.json, 2026-12-03, commit 2887c2d69196 |
## Production Findings
### Erosion
| Function | Cyclomatic complexity | Source lines | Function mass |
| -------- | --------------------- | ------------ | ------------- |
| `route` (`src/route.ts:1`) | 16 | 18 | 67.8823 |
### Verbosity
| Flagged line | Rule |
| ------------ | ---- |
| `src/sign.ts:4` | else-after-return |
## Files not measured
- `src/broken.ts`: cannot parse: Unexpected token at line 1, column 23
- `src/types.d.ts`: declaration only