Problem
Options.parse (src/Options.ts L73) is CLI-only, and the only path filtering is .gitignore (TypeScriptDuplicateFinder.gitignoreMatcher). Consequences:
- No persisted, repo-checked-in ignore globs independent of
.gitignore.
- One global
threshold/minNodes/minLines for the whole scan — you can't run tests/** looser than src/**, even though test arrange-blocks are a known noise source (≈half the clusters on the abholer run).
Proposed change
Load a config file (.dryrc / dry.config.json) and merge it under CLI precedence:
- In
Options (or a small loader feeding Options.from), read the config from cwd; CLI flags override config, config overrides Options.defaults().
- Support
ignore: string[] globs applied in addition to .gitignore in typeScriptFiles (reuse the existing ignore dependency).
- Support
overrides: [{ paths: glob, threshold?, minNodes?, minLines? }]. Plumb per-path config into clustersFor/matchingPairs (FileScanner is already per-file, so per-file threshold/minNodes is tractable; document the rule for a pair spanning two override scopes — e.g. use the stricter of the two).
Acceptance
- A config setting
minNodes: 30 for tests/** and 20 for src/** produces the expected per-tree filtering in a single run.
ignore globs exclude matching files without touching .gitignore.
- CLI flags still override config values.
Related
The umbrella config surface for the false-positive-reduction set; per-path excludeKinds/minDistinctKinds from the sibling issues can ride on the same overrides mechanism.
Problem
Options.parse(src/Options.tsL73) is CLI-only, and the only path filtering is.gitignore(TypeScriptDuplicateFinder.gitignoreMatcher). Consequences:.gitignore.threshold/minNodes/minLinesfor the whole scan — you can't runtests/**looser thansrc/**, even though test arrange-blocks are a known noise source (≈half the clusters on the abholer run).Proposed change
Load a config file (
.dryrc/dry.config.json) and merge it under CLI precedence:Options(or a small loader feedingOptions.from), read the config from cwd; CLI flags override config, config overridesOptions.defaults().ignore: string[]globs applied in addition to.gitignoreintypeScriptFiles(reuse the existingignoredependency).overrides: [{ paths: glob, threshold?, minNodes?, minLines? }]. Plumb per-path config intoclustersFor/matchingPairs(FileScanner is already per-file, so per-file threshold/minNodes is tractable; document the rule for a pair spanning two override scopes — e.g. use the stricter of the two).Acceptance
minNodes: 30fortests/**and20forsrc/**produces the expected per-tree filtering in a single run.ignoreglobs exclude matching files without touching.gitignore.Related
The umbrella config surface for the false-positive-reduction set; per-path
excludeKinds/minDistinctKindsfrom the sibling issues can ride on the sameoverridesmechanism.