From 4cbcc9db8909625cdbfcc916492e90afe32db8fc Mon Sep 17 00:00:00 2001 From: Ned Palacios Date: Mon, 15 Apr 2024 20:46:59 +0800 Subject: [PATCH] fix: do not include file not found messages --- .../analyzer/error_quotient/error_quotient.go | 5 ++++ .../repeated_error_density.go | 23 ++++++++++--------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/server/logger/analyzer/error_quotient/error_quotient.go b/server/logger/analyzer/error_quotient/error_quotient.go index f3c6593..15f6855 100644 --- a/server/logger/analyzer/error_quotient/error_quotient.go +++ b/server/logger/analyzer/error_quotient/error_quotient.go @@ -211,6 +211,11 @@ func (e *Analyzer) Analyze(writer analyzer.KVWriter, loaders ...analyzer.LoggerL continue } + // Skip if the error message is "file not found". This is not the programmers fault. + if strings.Contains(entry.ErrorMessage, "error: file not found:") { + continue + } + participantId := entry.ParticipantId if _, ok := logEntries[participantId]; !ok { logEntries[participantId] = internal.NewResultStore[[]logger.LogEntry]() diff --git a/server/logger/analyzer/repeated_error_density/repeated_error_density.go b/server/logger/analyzer/repeated_error_density/repeated_error_density.go index c5d812f..0d10441 100644 --- a/server/logger/analyzer/repeated_error_density/repeated_error_density.go +++ b/server/logger/analyzer/repeated_error_density/repeated_error_density.go @@ -3,6 +3,7 @@ package repeatederrordensity import ( "fmt" "os" + "strings" "github.com/nedpals/bugbuddy/server/logger/analyzer" ) @@ -38,6 +39,11 @@ func (e *Analyzer) Analyze(writer analyzer.KVWriter, loaders ...analyzer.LoggerL fmt.Fprintln(os.Stderr, err) } + // skip if the error message is "file not found". This is not the programmers fault. + if strings.Contains(entry.ErrorMessage, "error: file not found:") { + continue + } + if _, ok := errorEvents[entry.ParticipantId]; !ok { errorEvents[entry.ParticipantId] = map[string][]ErrorEvent{} } @@ -46,9 +52,14 @@ func (e *Analyzer) Analyze(writer analyzer.KVWriter, loaders ...analyzer.LoggerL errorEvents[entry.ParticipantId][entry.FilePath] = []ErrorEvent{} } + errorType := entry.ErrorType + if entry.ErrorCode != 0 && len(errorType) == 0 && strings.Contains(entry.GeneratedOutput, "# UnknownError") { + errorType = "UnknownError" + } + errorEvents[entry.ParticipantId][entry.FilePath] = append(errorEvents[entry.ParticipantId][entry.FilePath], ErrorEvent{ IsError: entry.ErrorCode != 0, - ErrorType: entry.ErrorType, + ErrorType: errorType, }) } @@ -58,16 +69,6 @@ func (e *Analyzer) Analyze(writer analyzer.KVWriter, loaders ...analyzer.LoggerL repeatedCount := 0 red := 0.0 - // if _, ok := e.ResultsByParticipant[participantId][filePath]; !ok { - // // find the closest file name first before adding the compilation event - // if found := fuzzy.RankFindFold(filePath, fileNames); len(found) != 0 { - // filePath = found[0].Target - // } else { - // fileNames = append(fileNames, filePath) - // e.ResultsByParticipant[participantId][filePath] = 0.0 - // } - // } - for _, event := range events { if event.IsError && event.ErrorType == currentErrorType { // Increase the count if the current error is the same as the last one.