From e6c1853e9fb46da8cb5bbb89b68d6ef31a018d9c Mon Sep 17 00:00:00 2001 From: Rui Azevedo Date: Thu, 4 Jul 2024 08:40:19 +0100 Subject: [PATCH 1/2] refactor, Remove unnecessary error check Part of #237 --- model/llm/llm.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/model/llm/llm.go b/model/llm/llm.go index 0b8e8d66..fa2caeb9 100644 --- a/model/llm/llm.go +++ b/model/llm/llm.go @@ -178,10 +178,6 @@ func (m *Model) WriteTests(ctx model.Context) (assessment metrics.Assessments, e assessment[metrics.AssessmentKeyResponseCharacterCount] = uint64(len(response)) assessment[metrics.AssessmentKeyGenerateTestsForFileCharacterCount] = uint64(len(testContent)) - if err != nil { - return nil, pkgerrors.WithStack(err) - } - testFilePath := ctx.Language.TestFilePath(ctx.RepositoryPath, ctx.FilePath) if err := os.MkdirAll(filepath.Join(ctx.RepositoryPath, filepath.Dir(testFilePath)), 0755); err != nil { return nil, pkgerrors.WithStack(err) From 8a753c92bc28fca670a3993203830ea3e7081d63 Mon Sep 17 00:00:00 2001 From: Rui Azevedo Date: Wed, 3 Jul 2024 13:47:36 +0100 Subject: [PATCH 2/2] refactor, Add the assessments for each task only after checking the errors Part of #237 --- evaluate/evaluate.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/evaluate/evaluate.go b/evaluate/evaluate.go index ad094a8a..1d8d69ba 100644 --- a/evaluate/evaluate.go +++ b/evaluate/evaluate.go @@ -135,7 +135,6 @@ func Evaluate(ctx *Context) (assessments *report.AssessmentStore, totalScore uin Logger: ctx.Log, } assessment, ps, err := task.Run(taskContext) - assessments.AddAssessmentPerTask(model, language, repositoryPath, assessment) if err != nil { ps = append(ps, err) } @@ -145,6 +144,7 @@ func Evaluate(ctx *Context) (assessments *report.AssessmentStore, totalScore uin } else { modelSucceededBasicChecksOfLanguage[model][language] = true } + assessments.AddAssessmentPerTask(model, language, repositoryPath, assessment) } }) } @@ -244,11 +244,11 @@ func Evaluate(ctx *Context) (assessments *report.AssessmentStore, totalScore uin Logger: ctx.Log, } assessment, ps, err := task.Run(taskContext) - assessments.AddAssessmentPerTask(model, language, repositoryPath, assessment) problemsPerModel[modelID] = append(problemsPerModel[modelID], ps...) if err != nil { ctx.Log.Printf("ERROR: Model %q encountered a hard error for language %q, repository %q: %+v", modelID, languageID, repositoryPath, err) } + assessments.AddAssessmentPerTask(model, language, repositoryPath, assessment) } }) }