Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧪 experimental: decayed + banded scoring #3466

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 86 additions & 78 deletions explorer/cnquery_explorer.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions explorer/cnquery_explorer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ enum ScoringSystem {
AVERAGE = 3;
DATA_ONLY = 4;
IGNORE_SCORE = 5;
// Experimental: BANDED scoring mechanism which creates a score based on
// the 4 categories of criticality (critical, high, medium, low) and
// positions scores so that:
// 1. Any critical/high issues won't generate a high score (upper limit)
// 2. Lower scoring categories can have an impact on the score
// (e.g. 1 crit + 200 medium failures will be lower than 1 crit only)
// 3. A large collection of medium findings won't generate a critical score
BANDED = 6;
// Experimental: DECAYED scoring uses a scaled decay function to estimate a
// score value. This means that a few critical findings will quickly reduce
// the resulting score, but it won't just drop it to the lowest value.
DECAYED = 7;
}

// Impact explains how important certain queries are. They are especially useful
Expand Down
12 changes: 12 additions & 0 deletions explorer/impact.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ func (s *ScoringSystem) UnmarshalJSON(data []byte) error {
*s = ScoringSystem_WEIGHTED
case "average", "":
*s = ScoringSystem_AVERAGE
case "banded":
*s = ScoringSystem_BANDED
case "decayed":
*s = ScoringSystem_DECAYED
default:
return errors.New("unknown scoring system: " + string(data))
}
Expand All @@ -149,6 +153,10 @@ func (s *ScoringSystem) UnmarshalYAML(node *yaml.Node) error {
*s = ScoringSystem_WEIGHTED
case "average", "":
*s = ScoringSystem_AVERAGE
case "banded":
*s = ScoringSystem_BANDED
case "decayed":
*s = ScoringSystem_DECAYED
default:
return errors.New("unknown scoring system: " + string(name))
}
Expand All @@ -164,6 +172,10 @@ func (s *ScoringSystem) MarshalYAML() (interface{}, error) {
return "weighted", nil
case ScoringSystem_AVERAGE:
return "average", nil
case ScoringSystem_BANDED:
return "banded", nil
case ScoringSystem_DECAYED:
return "decayed", nil
default:
return *s, nil
}
Expand Down
Loading