-
Notifications
You must be signed in to change notification settings - Fork 10
Combined early merges #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,7 +47,7 @@ type Evaluate struct { | |
| // ResultPath holds the directory path where results should be written to. | ||
| ResultPath string `long:"result-path" description:"Directory path where results should be written to. The placeholder \"%datetime%\" can be used for the current date and time." default:"evaluation-%datetime%"` | ||
| // Runs holds the number of runs to perform. | ||
| Runs uint `long:"runs" description:"Number of runs to perform." default:"1"` | ||
| Runs uint64 `long:"runs" description:"Number of runs to perform." default:"1"` | ||
| // TestdataPath determines the testdata path where all repositories reside grouped by languages. | ||
| TestdataPath string `long:"testdata" description:"Path to the testdata directory where all repositories reside grouped by languages." default:"testdata/"` | ||
|
|
||
|
|
@@ -235,7 +235,7 @@ func (command *Evaluate) Execute(args []string) (err error) { | |
| assessments := report.NewAssessmentPerModelPerLanguagePerRepository(maps.Values(modelsSelected), maps.Values(languagesSelected), command.Repositories) | ||
| problemsPerModel := map[string][]error{} | ||
| { | ||
| for r := uint(0); r < command.Runs; r++ { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Early merging this commit. @ruiAzevedo19 when you do an early merger, please always make sure that the commits you are adding are working. don't work on features in an early merger, instead, early merge. |
||
| for r := uint64(0); r < command.Runs; r++ { | ||
| if command.Runs > 1 { | ||
| log.Printf("Run %d/%d", r+1, command.Runs) | ||
| } | ||
|
|
@@ -263,7 +263,7 @@ func (command *Evaluate) Execute(args []string) (err error) { | |
|
|
||
| // Evaluating models and languages. | ||
| log.Printf("Evaluating models and languages") | ||
| for r := uint(0); r < command.Runs; r++ { | ||
| for r := uint64(0); r < command.Runs; r++ { | ||
| if command.Runs > 1 { | ||
| log.Printf("Run %d/%d", r+1, command.Runs) | ||
| } | ||
|
|
@@ -306,7 +306,7 @@ func (command *Evaluate) Execute(args []string) (err error) { | |
| } | ||
| } | ||
|
|
||
| totalScore := uint(0) | ||
| totalScore := uint64(0) | ||
| // Set the total score to the number of evaluated languages if we are just checking the "plain" repositories since there is only one task to solve per language. | ||
| isOnlyPlainRepositories := true | ||
| for repository := range commandRepositories { | ||
|
|
@@ -317,7 +317,7 @@ func (command *Evaluate) Execute(args []string) (err error) { | |
| } | ||
| } | ||
| if isOnlyPlainRepositories { | ||
| totalScore = uint(len(languagesSelected)) * command.Runs | ||
| totalScore = uint64(len(languagesSelected)) * command.Runs | ||
| } | ||
|
|
||
| assessmentsPerModel := assessments.CollapseByModel() | ||
|
|
@@ -336,7 +336,7 @@ func (command *Evaluate) Execute(args []string) (err error) { | |
| return err | ||
| } | ||
|
|
||
| _ = assessmentsPerModel.WalkByScore(func(model model.Model, assessment metrics.Assessments, score uint) (err error) { | ||
| _ = assessmentsPerModel.WalkByScore(func(model model.Model, assessment metrics.Assessments, score uint64) (err error) { | ||
| log.Printf("Evaluation score for %q (%q): %s", model.ID(), assessment.Category(totalScore).ID, assessment) | ||
|
|
||
| return nil | ||
|
|
||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,19 +16,19 @@ var ( | |
| // AllAssessmentKeysStrings returns all registered assessment keys as strings. | ||
| AllAssessmentKeysStrings []string | ||
|
|
||
| // pointsPerAssessment holds the points awarded for a specific assessment. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. COmmit subject "Redo the coverage logic" same rules as internally. What, and why. |
||
| pointsPerAssessment = map[AssessmentKey]uint{} | ||
| // multiplierPerAssessment holds the multipliers awarded for a specific assessment. | ||
| multiplierPerAssessment = map[AssessmentKey]uint64{} | ||
| ) | ||
|
|
||
| // RegisterAssessmentKey registers a new assessment key. | ||
| // If the points for this assessment type are zero, it is ignored for the score computation. | ||
| func RegisterAssessmentKey(key string, points uint) AssessmentKey { | ||
| // If the multiplier for this assessment type is zero, it is ignored for the score computation. | ||
| func RegisterAssessmentKey(key string, multiplier uint64) AssessmentKey { | ||
| assessment := AssessmentKey(key) | ||
| i := sort.SearchStrings(AllAssessmentKeysStrings, key) | ||
|
|
||
| allAssessmentKeys = slices.Insert(allAssessmentKeys, i, assessment) | ||
| AllAssessmentKeysStrings = slices.Insert(AllAssessmentKeysStrings, i, key) | ||
| pointsPerAssessment[assessment] = points | ||
| multiplierPerAssessment[assessment] = multiplier | ||
|
|
||
| return assessment | ||
| } | ||
|
|
@@ -39,8 +39,8 @@ var ( | |
| // AssessmentKeyProcessingTime holds the time in milliseconds that it took to complete the task. | ||
| AssessmentKeyProcessingTime = RegisterAssessmentKey("processing-time", 0) | ||
|
|
||
| // AssessmentKeyCoverageStatement counts the cases where 100% coverage was reached. | ||
| AssessmentKeyCoverageStatement = RegisterAssessmentKey("coverage-statement", 10) | ||
| // AssessmentKeyCoverage counts execution coverage objects. | ||
| AssessmentKeyCoverage = RegisterAssessmentKey("coverage", 2) | ||
|
|
||
| // AssessmentKeyResponseNoError indicates that a model responded without error. | ||
| AssessmentKeyResponseNoError = RegisterAssessmentKey("response-no-error", 1) | ||
|
|
@@ -52,11 +52,11 @@ var ( | |
| ) | ||
|
|
||
| // Assessments holds a collection of numerical assessment metrics. | ||
| type Assessments map[AssessmentKey]uint | ||
| type Assessments map[AssessmentKey]uint64 | ||
|
|
||
| // NewAssessments creates a new assessment collection. | ||
| func NewAssessments() Assessments { | ||
| return map[AssessmentKey]uint{} | ||
| return map[AssessmentKey]uint64{} | ||
| } | ||
|
|
||
| // Add adds the given assessment collection to the current one. | ||
|
|
@@ -95,13 +95,13 @@ func Merge(a Assessments, b Assessments) (c Assessments) { | |
| } | ||
|
|
||
| // Score computes the score over all assessments in the collection. | ||
| func (a Assessments) Score() (score uint) { | ||
| func (a Assessments) Score() (score uint64) { | ||
| if len(a) == 0 { | ||
| return 0 | ||
| } | ||
|
|
||
| for key, value := range a { | ||
| if pointsPerAssessment[key] != 0 { | ||
| if multiplierPerAssessment[key] != 0 { | ||
| score += value | ||
| } | ||
| } | ||
|
|
@@ -111,7 +111,12 @@ func (a Assessments) Score() (score uint) { | |
|
|
||
| // Award yields the score points defined for the given key. | ||
| func (a Assessments) Award(key AssessmentKey) { | ||
| a[key] += pointsPerAssessment[key] | ||
| a[key] += multiplierPerAssessment[key] | ||
| } | ||
|
|
||
| // Award yields multiple score points defined for the given key. | ||
| func (a Assessments) AwardPoints(key AssessmentKey, count uint64) { | ||
| a[key] += multiplierPerAssessment[key] * count | ||
| } | ||
|
|
||
| // String returns a string representation of the metrics. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit subject: not for longer values, but to be consistent explicitly.