Skip to content

Commit dd51754

Browse files
authored
Further fix unsound and notice reporting (#10) (#11)
1 parent 7cb7a4e commit dd51754

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.4.1] - 2023-04-04
9+
10+
### Fixed
11+
12+
- Corrected reporting on `unsound` and `notice` informationals
13+
14+
## [1.4.0] - 2023-04-04
15+
16+
### Fixed
17+
18+
- Reflect change to enable warning on `unsound` and `notice` informationals
19+
820
## [1.3.2] - 2023-03-13
921

1022
### Changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rust-audit-check",
3-
"version": "1.3.2",
3+
"version": "1.4.1",
44
"private": false,
55
"description": "Security audit for security vulnerabilities",
66
"main": "lib/main.js",

src/reporter.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface Stats {
1515
critical: number;
1616
notices: number;
1717
unmaintained: number;
18+
unsound: number;
1819
other: number;
1920
}
2021

@@ -89,6 +90,7 @@ function getStats(
8990
let critical = 0;
9091
let notices = 0;
9192
let unmaintained = 0;
93+
let unsound = 0;
9294
let other = 0;
9395
for (const vulnerability of vulnerabilities) {
9496
switch (vulnerability.advisory.informational) {
@@ -98,6 +100,9 @@ function getStats(
98100
case 'unmaintained':
99101
unmaintained += 1;
100102
break;
103+
case 'unsound':
104+
unsound += 1;
105+
break;
101106
case null:
102107
critical += 1;
103108
break;
@@ -113,6 +118,10 @@ function getStats(
113118
unmaintained += 1;
114119
break;
115120

121+
case 'unsound':
122+
unsound += 1;
123+
break;
124+
116125
default:
117126
// Both yanked and informational types of kind
118127
other += 1;
@@ -124,6 +133,7 @@ function getStats(
124133
critical: critical,
125134
notices: notices,
126135
unmaintained: unmaintained,
136+
unsound: unsound,
127137
other: other,
128138
};
129139
}
@@ -132,15 +142,17 @@ function getSummary(stats: Stats): string {
132142
const blocks: string[] = [];
133143

134144
if (stats.critical > 0) {
135-
// TODO: Plural
136-
blocks.push(`${stats.critical} advisory(ies)`);
145+
blocks.push(`${stats.critical} advisories`);
137146
}
138147
if (stats.notices > 0) {
139148
blocks.push(`${stats.notices} notice${plural(stats.notices)}`);
140149
}
141150
if (stats.unmaintained > 0) {
142151
blocks.push(`${stats.unmaintained} unmaintained`);
143152
}
153+
if (stats.unsound > 0) {
154+
blocks.push(`${stats.unsound} unsound`);
155+
}
144156
if (stats.other > 0) {
145157
blocks.push(`${stats.other} other`);
146158
}
@@ -275,6 +287,8 @@ export async function reportIssues(
275287
for (const warning of warnings) {
276288
let advisory: interfaces.Advisory;
277289
switch (warning.kind) {
290+
case 'unsound':
291+
case 'notice':
278292
case 'unmaintained':
279293
case 'informational':
280294
advisory = warning.advisory;

0 commit comments

Comments
 (0)