Skip to content

Commit b7d35a3

Browse files
committed
internal/report: fix issue with lint/fix in unexclude
Some operations in "unexclude" were incorrectly operating on the old report instead of the new report; fix this. Change-Id: Iaae67a6292bb10e0840e9841cccd0ffe1cc5d4ba Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/576995 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
1 parent d974909 commit b7d35a3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

cmd/vulnreport/unexclude.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,8 @@ func (u *unexclude) run(ctx context.Context, filename string) (err error) {
8989
// Remove description because this is a "basic" report.
9090
newR.Description = ""
9191

92-
r.Fix(u.pc)
93-
if hasLints := newR.LintAsNotes(u.pc); hasLints {
94-
log.Warnf("unexcluded report %s has lint errors that need to be fixed manually", filename)
95-
}
92+
newR.Fix(u.pc)
93+
hasLints := newR.LintAsNotes(u.pc)
9694

9795
if err := os.Remove(filename); err != nil {
9896
log.Errf("could not remove excluded report: %v", err)
@@ -103,6 +101,11 @@ func (u *unexclude) run(ctx context.Context, filename string) (err error) {
103101
if err != nil {
104102
return err
105103
}
104+
105+
if hasLints {
106+
log.Warnf("unexcluded report %s has lint errors that need to be fixed manually", newFilename)
107+
}
108+
106109
log.Out(newFilename)
107110

108111
return nil

0 commit comments

Comments
 (0)