@@ -9,27 +9,39 @@ import (
99 "strings"
1010
1111 pkgerrors "github.com/pkg/errors"
12- "github.com/symflower/eval-dev-quality/util"
1312 "github.com/zimmski/osutil"
13+
14+ "github.com/symflower/eval-dev-quality/evaluate/metrics"
15+ "github.com/symflower/eval-dev-quality/util"
1416)
1517
1618// RepositoryConfiguration holds the configuration of a repository.
1719type RepositoryConfiguration struct {
1820 // Tasks holds the tasks supported by the repository.
19- Tasks []Identifier
21+ Tasks []Identifier `json:"tasks"`
2022 // IgnorePaths holds the relative paths that should be ignored when searching for cases.
2123 IgnorePaths []string `json:"ignore,omitempty"`
2224
2325 // Prompt holds LLM prompt-related configuration.
24- Prompt struct {
25- // TestFramework overwrites the language-specific test framework to use.
26- TestFramework string `json:"test-framework,omitempty"`
27- } `json:",omitempty"`
26+ Prompt RepositoryConfigurationPrompt `json:"prompt,omitempty"`
2827
2928 // Validation holds quality gates for evaluation.
30- Validation struct {
31- Execution RepositoryConfigurationExecution `json:",omitempty"`
32- }
29+ Validation RepositoryConfigurationValidation `json:"validation,omitempty"`
30+
31+ // MaxScores holds the maximum scores per task type, case and metric for this repository.
32+ MaxScores map [Identifier ]map [string ]map [metrics.AssessmentKey ]uint64 `json:"scores,omitempty"`
33+ }
34+
35+ // RepositoryConfigurationPrompt holds LLM prompt-related configuration.
36+ type RepositoryConfigurationPrompt struct {
37+ // TestFramework overwrites the language-specific test framework to use.
38+ TestFramework string `json:"test-framework,omitempty"`
39+ }
40+
41+ // RepositoryConfigurationValidation holds quality gates for evaluation.
42+ type RepositoryConfigurationValidation struct {
43+ // Execution holds execution-related validation.
44+ Execution RepositoryConfigurationExecution `json:"execution,omitempty"`
3345}
3446
3547// RepositoryConfigurationExecution execution-related quality gates for evaluation.
@@ -67,6 +79,16 @@ func LoadRepositoryConfiguration(path string, defaultTasks []Identifier) (config
6779 return config , nil
6880}
6981
82+ // Write stores the configuration on the given path.
83+ func (rc * RepositoryConfiguration ) Write (path string ) (err error ) {
84+ data , err := json .Marshal (rc )
85+ if err != nil {
86+ return err
87+ }
88+
89+ return os .WriteFile (path , data , 0666 )
90+ }
91+
7092// validate validates the configuration.
7193func (rc * RepositoryConfiguration ) validate (validTasks []Identifier ) (err error ) {
7294 if len (rc .Tasks ) == 0 {
0 commit comments