1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 18:15:42 +01:00

Follow Go naming conventions for receivers.

This commit is contained in:
Sascha L. Teichmann 2023-07-05 22:40:52 +02:00
parent a95ff9faf0
commit fddc363344

View file

@ -53,34 +53,34 @@ func tlpLabel(label *csaf.TLPLabel) csaf.TLPLabel {
} }
// add registers a given url to a label. // add registers a given url to a label.
func (ca *rolieLabelChecker) add(label csaf.TLPLabel, url string) { func (rlc *rolieLabelChecker) add(label csaf.TLPLabel, url string) {
advs := ca.advisories[label] advs := rlc.advisories[label]
if advs == nil { if advs == nil {
advs = util.Set[string]{} advs = util.Set[string]{}
ca.advisories[label] = advs rlc.advisories[label] = advs
} }
advs.Add(url) advs.Add(url)
} }
// check tests if the TLP label of an advisory is used correctly. // check tests if the TLP label of an advisory is used correctly.
func (ca *rolieLabelChecker) check( func (rlc *rolieLabelChecker) check(
p *processor, p *processor,
label csaf.TLPLabel, label csaf.TLPLabel,
url string, url string,
) { ) {
// Associate advisory label to urls. // Associate advisory label to urls.
ca.add(label, url) rlc.add(label, url)
// If entry shows up in feed of higher tlp level, give out info or warning. // If entry shows up in feed of higher tlp level, give out info or warning.
ca.checkRank(p, label, url) rlc.checkRank(p, label, url)
// Issue warnings or errors if the advisory is not protected properly. // Issue warnings or errors if the advisory is not protected properly.
ca.checkProtection(p, label, url) rlc.checkProtection(p, label, url)
} }
// checkProtection tests if a given advisory has the right level // checkProtection tests if a given advisory has the right level
// of protection. // of protection.
func (ca *rolieLabelChecker) checkProtection( func (rlc *rolieLabelChecker) checkProtection(
p *processor, p *processor,
label csaf.TLPLabel, label csaf.TLPLabel,
url string, url string,
@ -133,30 +133,30 @@ func (ca *rolieLabelChecker) checkProtection(
// checkRank tests if a given advisory is contained by the // checkRank tests if a given advisory is contained by the
// the right feed color. // the right feed color.
func (ca *rolieLabelChecker) checkRank( func (rlc *rolieLabelChecker) checkRank(
p *processor, p *processor,
label csaf.TLPLabel, label csaf.TLPLabel,
url string, url string,
) { ) {
switch advisoryRank, feedRank := tlpLevel(label), tlpLevel(ca.feedLabel); { switch advisoryRank, feedRank := tlpLevel(label), tlpLevel(rlc.feedLabel); {
case advisoryRank < feedRank: case advisoryRank < feedRank:
if advisoryRank == 0 { // All kinds of 'UNLABELED' if advisoryRank == 0 { // All kinds of 'UNLABELED'
p.badROLIEFeed.info( p.badROLIEFeed.info(
"Found unlabeled advisory %q in feed %q.", "Found unlabeled advisory %q in feed %q.",
url, ca.feedURL) url, rlc.feedURL)
} else { } else {
p.badROLIEFeed.warn( p.badROLIEFeed.warn(
"Found advisory %q labled TLP:%s in feed %q (TLP:%s).", "Found advisory %q labled TLP:%s in feed %q (TLP:%s).",
url, label, url, label,
ca.feedURL, ca.feedLabel) rlc.feedURL, rlc.feedLabel)
} }
case advisoryRank > feedRank: case advisoryRank > feedRank:
// Must not happen, give error // Must not happen, give error
p.badROLIEFeed.error( p.badROLIEFeed.error(
"%s of TLP level %s must not be listed in feed %s of TLP level %s", "%s of TLP level %s must not be listed in feed %s of TLP level %s",
url, label, ca.feedURL, ca.feedLabel) url, label, rlc.feedURL, rlc.feedLabel)
} }
} }