Skip to content

Commit a75c727

Browse files
committed
internal/report: add lint check for source
Add a lint check to ensure that original reports created by the Go team are always marked REVIEWED. Change-Id: I5d72998be1597e42ec5ae5e05d4a5d9a4324cb40 Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/590276 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Damien Neil <[email protected]>
1 parent a460ba8 commit a75c727

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

internal/report/lint.go

+10
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,15 @@ func (r *Report) lintReviewStatus(l *linter) {
259259
}
260260
}
261261

262+
func (r *Report) lintSource(l *linter) {
263+
if r.SourceMeta == nil {
264+
return
265+
}
266+
if !r.IsReviewed() && r.SourceMeta.ID == sourceGoTeam {
267+
l.Errorf("source: if id=%s, report must be %s", sourceGoTeam, Reviewed)
268+
}
269+
}
270+
262271
func (r *Report) countAdvisories() int {
263272
advisoryCount := 0
264273
for _, ref := range r.References {
@@ -496,6 +505,7 @@ func (r *Report) lint(pc *proxy.Client) []string {
496505

497506
r.lintReferences(l)
498507
r.lintReviewStatus(l)
508+
r.lintSource(l)
499509

500510
if r.hasTODOs() {
501511
l.Error("contains one or more TODOs")

0 commit comments

Comments
 (0)