Skip to content

Commit 19b3a84

Browse files
authored
Merge pull request #3849 from github/henrymercer/simplify-diff-range-interface
Simplify `writeDiffRangeDataExtensionPack` interface
2 parents c60c755 + 858a614 commit 19b3a84

2 files changed

Lines changed: 9 additions & 30 deletions

File tree

lib/analyze-action.js

Lines changed: 3 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/analyze.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -251,16 +251,9 @@ export async function setupDiffInformedQueryRun(
251251
diffRanges,
252252
checkoutPath,
253253
);
254-
if (packDir === undefined) {
255-
logger.warning(
256-
"Cannot create diff range extension pack for diff-informed queries; " +
257-
"reverting to performing full analysis.",
258-
);
259-
} else {
260-
logger.info(
261-
`Successfully created diff range extension pack at ${packDir}.`,
262-
);
263-
}
254+
logger.info(
255+
`Successfully created diff range extension pack at ${packDir}.`,
256+
);
264257
return packDir;
265258
},
266259
);
@@ -314,18 +307,13 @@ extensions:
314307
* @param ranges The file line ranges, as returned by
315308
* `getPullRequestEditedDiffRanges`.
316309
* @param checkoutPath The path at which the repository was checked out.
317-
* @returns The absolute path of the directory containing the extension pack, or
318-
* `undefined` if no extension pack was created.
310+
* @returns The absolute path of the directory containing the extension pack.
319311
*/
320312
function writeDiffRangeDataExtensionPack(
321313
logger: Logger,
322-
ranges: DiffThunkRange[] | undefined,
314+
ranges: DiffThunkRange[],
323315
checkoutPath: string,
324-
): string | undefined {
325-
if (ranges === undefined) {
326-
return undefined;
327-
}
328-
316+
): string {
329317
if (ranges.length === 0) {
330318
// An empty diff range means that there are no added or modified lines in
331319
// the pull request. But the `restrictAlertsTo` extensible predicate

0 commit comments

Comments
 (0)