internal/report: separate checking filenames from linting
Move the filename check out of Lint and into its own function. Now
a report can be linted independently of its filename.
We still check that filenames are correct in "vulnreport lint" and
other commands, and in the big TestLintReports test.
Change-Id: Ic7a5bb50de51aa72cb41179ef6a9303c7b5ecff3
Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/498279
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Tatiana Bradley <tatianabradley@google.com>
diff --git a/all_test.go b/all_test.go
index d8c3634..b690938 100644
--- a/all_test.go
+++ b/all_test.go
@@ -77,7 +77,10 @@
if err != nil {
t.Fatal(err)
}
- lints := r.Lint(filename)
+ if err := r.CheckFilename(filename); err != nil {
+ t.Error(err)
+ }
+ lints := r.Lint()
if len(lints) > 0 {
t.Errorf(strings.Join(lints, "\n"))
}