1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 05:40:11 +01:00

Dedup code a bit

This commit is contained in:
Sascha L. Teichmann 2023-08-23 17:14:49 +02:00
parent 12815430ec
commit 4dfa2dd552

View file

@ -1131,18 +1131,19 @@ func (p *processor) checkMissing(string) error {
}
}
// List error in all appropriate categories
if mistake&rolieMask != 0 {
p.badROLIEFeed.error("%s %s", f, strings.Join(where, ", "))
if mistake&(rolieMask|indexMask|changesMask|listingMask) == 0 {
continue
}
if mistake&indexMask != 0 {
p.badIndices.error("%s %s", f, strings.Join(where, ", "))
}
if mistake&changesMask != 0 {
p.badChanges.error("%s %s", f, strings.Join(where, ", "))
}
if mistake&listingMask != 0 {
p.badDirListings.error("%s %s", f, strings.Join(where, ", "))
joined := strings.Join(where, ", ")
report := func(mask whereType, msgs *topicMessages) {
if mistake&mask != 0 {
msgs.error("%s %s", f, joined)
}
}
report(rolieMask, &p.badROLIEFeed)
report(indexMask, &p.badIndices)
report(changesMask, &p.badChanges)
report(listingMask, &p.badDirListings)
}
return nil
}