-
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 fix" to a "write-test" result of a model when i…
…t errors, so model responses can possibly be fixed Part of #213
- Loading branch information
1 parent
608b4c5
commit 475a3c1
Showing
4 changed files
with
139 additions
and
1 deletion.
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,50 @@ | ||
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" | ||
) | ||
|
||
// symflowerFix runs the "symflower fix" command and returns the corresponding assessments. | ||
func symflowerFix(logger *log.Logger, modelAssessment metrics.Assessments, repositoryPath string, language language.Language) (assessments metrics.Assessments, problems []error, err error) { | ||
assessments = metrics.NewAssessments() | ||
|
||
start := time.Now() | ||
output, err := util.CommandWithResult(context.Background(), logger, &util.Command{ | ||
Command: []string{ | ||
tools.SymflowerPath, "fix", | ||
"--language", language.ID(), | ||
"--workspace", repositoryPath, | ||
}, | ||
|
||
Directory: repositoryPath, | ||
}) | ||
if err != nil { | ||
return nil, nil, pkgerrors.WithStack(err) | ||
} | ||
duration := time.Since(start) | ||
logger.Printf("with symflower repair: %s", output) | ||
|
||
// The processing time is summed with the one from the model. | ||
assessments[metrics.AssessmentKeyProcessingTime] = modelAssessment[metrics.AssessmentKeyProcessingTime] + uint64(duration.Milliseconds()) | ||
|
||
coverage, ps, err := language.Execute(logger, repositoryPath) | ||
problems = append(problems, ps...) | ||
if err != nil { | ||
return nil, ps, pkgerrors.WithStack(err) | ||
} | ||
logger.Printf("with symflower repair: Executes tests with %d coverage objects", coverage) | ||
|
||
assessments.Award(metrics.AssessmentKeyFilesExecuted) | ||
assessments.Award(metrics.AssessmentKeyResponseNoError) | ||
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