Configuration
Necro reads an optional necro.config.json from the directory it’s invoked in.
Values are merged over the defaults per key (a key you set replaces its
default; it is not concatenated). With no config file, the defaults are used
verbatim.
include
Section titled “include”- Type:
string[] - Default:
["**/*.ts", "**/*.tsx"]
Globs of files to analyze.
ignore
Section titled “ignore”- Type:
string[] - Default:
["**/node_modules/**", "**/dist/**"]
Globs to exclude from analysis.
coveragePath
Section titled “coveragePath”- Type:
string - Default:
"coverage/lcov.info"
Path to an lcov report (relative
to the scan target, or absolute). When the report exists, necro folds runtime
coverage into each finding — see scan → Coverage.
necro reads the report only; it never runs your tests. The --coverage flag
overrides this key.
complexity
Section titled “complexity”- Type: object (partial — unset keys keep their default)
- Defaults:
{ nesting: 3, cyclomatic: 10, cognitive: 15, godFunctionLoc: 50, godFunctionParams: 5 }
Thresholds for the complexity detectors. A function is flagged when it exceeds a threshold. Override only the keys you want; the rest fall back to the defaults above.
hotspots
Section titled “hotspots”- Type: object
- Default:
{ top: 10 }
Options for the risk-hotspot ranking. top sets how
many hotspots scan shows.
duplication
Section titled “duplication”- Type: object
- Default:
{ minTokens: 50 }
Options for the duplication detector. minTokens
is the smallest normalized-token sequence reported as a clone.
- Type: object
- Default:
{ model: "claude-opus-4-8", snippetRadius: 20 }
Options for the opt-in LLM layer (triage
and refactor). model is the Anthropic
model id; snippetRadius is how many lines of context around a finding are sent.
Used only when you invoke those commands, which require ANTHROPIC_API_KEY.
Example
Section titled “Example”{ "include": ["**/*.ts", "**/*.tsx"], "ignore": ["**/node_modules/**", "**/dist/**", "**/*.generated.ts"], "coveragePath": "coverage/lcov.info", "complexity": { "cyclomatic": 15, "godFunctionLoc": 80 }, "hotspots": { "top": 20 }, "duplication": { "minTokens": 80 }}Always skipped
Section titled “Always skipped”Independent of ignore, declaration files (*.d.ts) and the directories
node_modules, .git, dist, build, and coverage are never analyzed.