-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TODO Apply "symflower repair" to a "write-test" result of a model whe…
…n it errors, so model responses can possibly be fixed Part of #213
- Loading branch information
1 parent
c728066
commit b9deae5
Showing
4 changed files
with
131 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package task | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
pkgerrors "github.com/pkg/errors" | ||
"github.com/symflower/eval-dev-quality/evaluate/metrics" | ||
"github.com/symflower/eval-dev-quality/language" | ||
"github.com/symflower/eval-dev-quality/log" | ||
"github.com/symflower/eval-dev-quality/tools" | ||
"github.com/symflower/eval-dev-quality/util" | ||
) | ||
|
||
// symflowerRepair runs the "symflower repair" command. | ||
func symflowerRepair(logger *log.Logger, modelAssessment metrics.Assessments, repositoryPath string, language language.Language) (assessments metrics.Assessments, problems []error, err error) { | ||
assessments = metrics.NewAssessments() | ||
|
||
start := time.Now() | ||
if _, err = util.CommandWithResult(context.Background(), logger, &util.Command{ | ||
Command: []string{ | ||
tools.SymflowerPath, "repair", | ||
"--language", language.ID(), | ||
"--workspace", repositoryPath, | ||
}, | ||
|
||
Directory: repositoryPath, | ||
}); err != nil { | ||
return nil, nil, pkgerrors.WithStack(err) | ||
} | ||
duration := time.Since(start) | ||
|
||
assessments[metrics.AssessmentKeyProcessingTime] = uint64(duration.Milliseconds()) | ||
assessments.Add(modelAssessment) | ||
|
||
coverage, ps, err := language.Execute(logger, repositoryPath) | ||
problems = append(problems, ps...) | ||
if err != nil { | ||
problems = append(problems, pkgerrors.WithStack(err)) | ||
|
||
return assessments, ps, err | ||
} | ||
|
||
logger.Printf("Executes tests with %d coverage objects", coverage) | ||
assessments.Award(metrics.AssessmentKeyFilesExecuted) | ||
assessments.AwardPoints(metrics.AssessmentKeyCoverage, coverage) | ||
|
||
return assessments, problems, err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters