Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion review-enrichment/src/analyzers/doc-comment-drift.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const MAX_FILES = 20;
const MAX_FINDINGS = 50;
const MAX_SIGNATURE_LINES = 40;
const MAX_FETCH_BYTES = 1_000_000;
const SOURCE_RE = /\.(?:ts|tsx|js|jsx|mjs|cjs)$/;
const SOURCE_RE = /\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs)$/;
const SKIP_RE = /(?:\.d\.ts$|\.min\.|\.test\.|\.spec\.|__tests__\/|(?:^|\/)tests?\/)/;
const SLUG_RE = /^[A-Za-z0-9._-]+$/;
// Matches a named `function` declaration up to its parameter `(`. A single, non-nested generic clause is allowed;
Expand Down
11 changes: 11 additions & 0 deletions review-enrichment/test/doc-comment-drift.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,17 @@ test("scanDocCommentDrift: fetches the file at headSha and reports drift", async
assert.deepEqual(findings[0].staleParams, ["oldName"]);
});

test("scanDocCommentDrift: analyzes TypeScript .mts/.cts module files too", async () => {
// SOURCE_RE includes the .mjs/.cjs siblings, so their TypeScript counterparts must
// be scanned as well or drift in .mts/.cts files is silently missed.
for (const path of ["src/a.mts", "src/a.cts"]) {
const findings = await scanDocCommentDrift(baseReq([{ path, patch: DRIFT_PATCH }]), fileWith(DRIFTED));
assert.equal(findings.length, 1);
assert.equal(findings[0].file, path);
assert.deepEqual(findings[0].staleParams, ["oldName"]);
}
});

test("scanDocCommentDrift: skips oversized file responses before reading the body", async () => {
let bodyAccessed = false;
const out = await scanDocCommentDrift(
Expand Down
Loading