Skip to content

Commit 98ffd8d

Browse files
committed
Truncate long GHSA lists in fix command output
1 parent 0cf2fea commit 98ffd8d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/commands/fix/coana-fix.mts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,11 @@ export async function coanaFix(
232232
return { ok: true, data: { fixed: false } }
233233
}
234234

235-
debugFn('notice', `fetch: ${ids.length} GHSA details for ${joinAnd(ids)}`)
235+
const displayIds =
236+
ids.length > 3
237+
? `${ids.slice(0, 3).join(', ')} ... and ${ids.length - 3} more`
238+
: joinAnd(ids)
239+
debugFn('notice', `fetch: ${ids.length} GHSA details for ${displayIds}`)
236240

237241
const ghsaDetails = await fetchGhsaDetails(ids)
238242
const scanBaseNames = new Set(scanFilepaths.map(p => path.basename(p)))

src/commands/fix/handle-fix.mts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,12 @@ export async function convertIdsToGhsas(ids: string[]): Promise<string[]> {
7171
const conversionResult = await convertPurlToGhsas(trimmedId)
7272
if (conversionResult.ok && conversionResult.data.length) {
7373
validGhsas.push(...conversionResult.data)
74+
const displayGhsas =
75+
conversionResult.data.length > 3
76+
? `${conversionResult.data.slice(0, 3).join(', ')} ... and ${conversionResult.data.length - 3} more`
77+
: joinAnd(conversionResult.data)
7478
logger.info(
75-
`Converted ${trimmedId} to ${conversionResult.data.length} GHSA(s): ${joinAnd(conversionResult.data)}`,
79+
`Converted ${trimmedId} to ${conversionResult.data.length} GHSA(s): ${displayGhsas}`,
7680
)
7781
} else {
7882
errors.push(

0 commit comments

Comments
 (0)