Skip to content

Commit 1169a82

Browse files
committed
fixup! feat: drop number of vulnerabilities on --pre-release
1 parent 6b726e9 commit 1169a82

1 file changed

Lines changed: 4 additions & 30 deletions

File tree

lib/security-release/security-release.js

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,7 @@ export const NEXT_SECURITY_RELEASE_REPOSITORY = {
1111
repo: 'security-release'
1212
};
1313

14-
const SEVERITY_RANK = {
15-
critical: 0,
16-
high: 1,
17-
medium: 2,
18-
low: 3
19-
};
20-
21-
const SEVERITY_LABEL = {
22-
critical: 'CRITICAL',
23-
high: 'HIGH',
24-
medium: 'MEDIUM',
25-
low: 'LOW'
26-
};
14+
const SEVERITY_RANKS = ['LOW', 'MEDIUM', 'HIGH', 'CRITICAL'];
2715

2816
export const PLACEHOLDERS = {
2917
releaseDate: '%RELEASE_DATE%',
@@ -144,24 +132,10 @@ export function formatDateToYYYYMMDD(date) {
144132
return `${year}/${month}/${day}`;
145133
}
146134

147-
export function getHighestSeverity(reports) {
148-
let highestSeverity = '';
149-
150-
for (const report of reports) {
151-
const rating = report.severity.rating.toLowerCase();
152-
const currentRank = SEVERITY_RANK[rating] ?? Number.MAX_SAFE_INTEGER;
153-
const highestRank = SEVERITY_RANK[highestSeverity] ?? Number.MAX_SAFE_INTEGER;
154-
155-
if (!highestSeverity || currentRank < highestRank) {
156-
highestSeverity = rating;
157-
}
158-
}
159-
160-
return SEVERITY_LABEL[highestSeverity] ?? highestSeverity.toUpperCase();
161-
}
162-
163135
export function getHighestSeverityAnnouncement(reports) {
164-
return `The highest severity issue fixed in this release is ${getHighestSeverity(reports)}.`;
136+
const highestSeverityIndex = Math.max(...reports.map(r => SECURITY_RANKS.indexOf(report.severity.rating)));
137+
138+
return `The highest severity issue fixed in this release is ${SEVERITY_RANKS[highestSeverityIndex] ?? 'NONE'}.`;
165139
}
166140

167141
export function promptDependencies(cli) {

0 commit comments

Comments
 (0)