Skip to content

Commit

Permalink
refactor, Rename the function that sorts evaluation records to a more…
Browse files Browse the repository at this point in the history
… generic name, since it can sort all kind of CSV records

Part of #296
  • Loading branch information
ruiAzevedo19 authored and Munsio committed Aug 28, 2024
1 parent e6ffee1 commit fc0e671
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cmd/eval-dev-quality/cmd/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (command *Report) Execute(args []string) (err error) {

return nil
}
report.SortEvaluationRecords(records)
report.SortRecords(records)

// Write all records into a single evaluation CSV file.
evaluationFile, err := report.NewEvaluationFile(evaluationCSVFile)
Expand Down
4 changes: 2 additions & 2 deletions evaluate/report/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ func assessmentFromRecord(assessmentFields []string) (assessments metrics.Assess
return assessments, nil
}

// SortEvaluationRecords sorts the evaluation records.
func SortEvaluationRecords(records [][]string) {
// SortRecords sorts CSV records.
func SortRecords(records [][]string) {
sort.Slice(records, func(i, j int) bool {
for x := range records[i] {
if records[i][x] == records[j][x] {
Expand Down
4 changes: 2 additions & 2 deletions evaluate/report/csv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ func TestEvaluationFileWriteLines(t *testing.T) {
})
}

func TestSortEvaluationRecords(t *testing.T) {
func TestSortRecords(t *testing.T) {
type testCase struct {
Name string

Expand All @@ -271,7 +271,7 @@ func TestSortEvaluationRecords(t *testing.T) {

validate := func(t *testing.T, tc *testCase) {
t.Run(tc.Name, func(t *testing.T) {
SortEvaluationRecords(tc.Records)
SortRecords(tc.Records)

assert.Equal(t, tc.ExpectedRecords, tc.Records)
})
Expand Down

0 comments on commit fc0e671

Please sign in to comment.