From 698a6193cc8e99a998a9bc51a60a7e98e28b7623 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Wed, 18 Jun 2025 02:57:29 -0400 Subject: [PATCH] feat(parser/elf): score for each entry --- internal/parser/elf/parser.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/parser/elf/parser.go b/internal/parser/elf/parser.go index 835b57c..eb40cfb 100644 --- a/internal/parser/elf/parser.go +++ b/internal/parser/elf/parser.go @@ -35,14 +35,19 @@ func (p *Elf) parse(executorResult stage.ExecutorResult, conf Conf) stage.Parser slog.Error("elf parse", "mapstructure decode err", err) } comment += fmt.Sprintf("### [%s] %s\n", report.File, report.Name) - for _, caseObj := range report.Cases { + caseScore := 0 + for range report.Cases { for _, match := range conf.Matches { for _, keyword := range match.Keywords { if strings.Contains(kind, keyword) { - score += -match.Score + caseScore += -match.Score } } } + } + score += caseScore + comment += fmt.Sprintf("%d point(s)\n", caseScore) + for _, caseObj := range report.Cases { switch kind { case "ParenDep": // ":\n below reaches a parentheses depths of :\n"