Repository navigation
Cover .mts and .cts sources in the docstring and duplication gates - #144
Conversation
#132 made both gates scan .tsx, but ES-module (.mts) and CommonJS (.cts) TypeScript sources still escaped them: the docstring walker and the duplication source filter accepted only .ts/.tsx, and the default jscpd glob was **/*.{ts,tsx}. Both gates now treat .ts, .tsx, .mts and .cts as authored sources and skip the .d.ts, .d.mts and .d.cts ambient forms; the directory walk and single-file roots share one predicate. Tests write real undocumented and duplicated .mts/.cts sources and run the real docstring analyzer and both jscpd engines; clean files pass and ambient declarations stay out of scope. release:check: 469 pass, coverage 100%. Closes #128 pm item: ops-zq8c
|
@coderabbitai full review |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Rate Limit Exceeded
|
Reviewer's GuideThe PR closes the TypeScript source-scope gap by treating authored Sequence diagram for duplication source-count reconciliationsequenceDiagram
participant Gate as Duplication gate
participant Glob as globMatchedSources
participant Jscpd as jscpd engine
participant Report as Duplication report
Gate->>Glob: globMatchedSources(repoRoot, pattern)
Glob-->>Gate: Authored .ts/.tsx/.mts/.cts sources
Gate->>Jscpd: Scan DEFAULT_DUPLICATION_GLOBS
Jscpd-->>Gate: Clone report and scanned-source count
Gate->>Report: Reconcile matched-source count
Report-->>Gate: Complete scan or fail closed
Flow diagram for unified authored TypeScript gate scopeflowchart LR
Files["TypeScript source files"] --> Predicate[isAuthoredTypeScriptSource]
Predicate -->|.ts .tsx .mts .cts| Docstrings[Docstring coverage gate]
Predicate -->|.d.ts .d.mts .d.cts excluded| Docstrings
Files --> Glob["DEFAULT_DUPLICATION_GLOBS"]
Glob --> Matched[globMatchedSources]
Matched -->|.ts .tsx .mts .cts| Duplication[Duplication gate]
Matched -->|ambient declarations excluded| Duplication
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
pm item: ops-zq8c
|
…ntry Review feedback: the generated changelog entry described the earlier .tsx fix, and an agent's `pm test --add --help` had recorded `--help` as a test command. pm item: ops-zq8c
|
@greptileai review |
Rate Limit Exceeded
|
|
@greptileai review |
Rate Limit Exceeded
|
What
docstrings.ts: oneisAuthoredTypeScriptSourcepredicate (.ts,.tsx,.mts,.cts; not.d.ts/.d.mts/.d.cts) shared by the directory walk and single-file roots.duplication.ts: default glob**/*.{ts,tsx,mts,cts}, ambient.d.mts/.d.ctsignored, matched-source filter widened to the same scope, so the fail-closed source-count reconciliation covers them.dist/rebuilt.Why
#128 reported
.tsxescaping both gates; #132 fixed.tsxbut.mts/.ctssources still bypassed docstring and duplication checks in every consumer package.Tests (real sources, real engines)
.mts/.ctsexports are reported in directory and single-file scans; documented ones pass; ambient declarations are skipped..mts/.ctsclones, scan clean ones under the default globs, and exclude.d.mts/.d.cts.npm run release:check: 469 pass, 0 fail, coverage 100/100/100/100, docstring/duplication/lint/attestation/lifecycle gates ok.pm item
Closes #128
Summary by Sourcery
Include authored
.mtsand.ctsfiles in docstring and duplication quality gates without admitting ambient declaration files.Bug Fixes:
.mtsand.ctssources while continuing to exclude ambient declaration files.Enhancements:
Documentation:
.mts/.ctscoverage and ambient declaration exclusions.Tests:
.mts/.ctsdocstring sources and both jscpd engines' duplication handling.Chores:
Summary by cubic
Covers authored
.mtsand.ctssources in the docstring and duplication gates so they no longer bypass those checks; ambient.d.mts/.d.ctsdeclarations stay out of scope.isAuthoredTypeScriptSourcepredicate (.ts,.tsx,.mts,.cts).**/*.{ts,tsx,mts,cts}, and ambient declarations are excluded from the source-count reconciliation.dist/are updated; tests run the real docstring analyzer and both jscpd engines against.mts/.ctsfixtures.Closes #128
Written for commit 617bb2d. Summary will update on new commits.