Skip to content

Commit

Permalink
Fixed code review comments.
Browse files Browse the repository at this point in the history
Signed-off-by: naveensrinivasan <[email protected]>
  • Loading branch information
naveensrinivasan committed Apr 10, 2023
1 parent 516bc37 commit cff053b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ issues:
linters:
- funlen
- goconst
- govet
- gocyclo
skip-files:
- cron/data/request.pb.go # autogenerated
Expand Down
2 changes: 2 additions & 0 deletions checker/check_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func TestListUnsupported(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := ListUnsupported(tt.args.required, tt.args.supported); cmp.Equal(got, tt.want) {
Expand Down Expand Up @@ -110,6 +111,7 @@ func Test_contains(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := contains(tt.args.in, tt.args.exists); got != tt.want {
Expand Down
23 changes: 17 additions & 6 deletions checker/check_result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func TestAggregateScores(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := AggregateScores(tt.args.scores...); got != tt.want { //nolint:govet
Expand Down Expand Up @@ -96,6 +97,7 @@ func TestAggregateScoresWithWeight(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := AggregateScoresWithWeight(tt.args.scores); got != tt.want { //nolint:govet
Expand Down Expand Up @@ -141,6 +143,7 @@ func TestCreateProportionalScore(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := CreateProportionalScore(tt.args.success, tt.args.total); got != tt.want { //nolint:govet
Expand Down Expand Up @@ -179,6 +182,7 @@ func TestNormalizeReason(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := NormalizeReason(tt.args.reason, tt.args.score); got != tt.want { //nolint:govet
Expand Down Expand Up @@ -208,9 +212,10 @@ func TestCreateResultWithScore(t *testing.T) {
score: 0,
},
want: CheckResult{
Name: "",
Reason: "",
Score: 0,
Name: "",
Reason: "",
Score: 0,
Version: 2,
},
},
{
Expand All @@ -229,6 +234,7 @@ func TestCreateResultWithScore(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := CreateResultWithScore(tt.args.name, tt.args.reason, tt.args.score); !cmp.Equal(got, tt.want) { //nolint:lll,govet
Expand Down Expand Up @@ -283,6 +289,7 @@ func TestCreateProportionalScoreResult(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := CreateProportionalScoreResult(tt.args.name, tt.args.reason, tt.args.b, tt.args.t); !cmp.Equal(got, tt.want) { //nolint:govet,lll
Expand Down Expand Up @@ -331,6 +338,7 @@ func TestCreateMaxScoreResult(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := CreateMaxScoreResult(tt.args.name, tt.args.reason); !cmp.Equal(got, tt.want) { //nolint:govet
Expand Down Expand Up @@ -379,9 +387,10 @@ func TestCreateMinScoreResult(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := CreateMinScoreResult(tt.args.name, tt.args.reason); !cmp.Equal(got, tt.want) {
if got := CreateMinScoreResult(tt.args.name, tt.args.reason); !cmp.Equal(got, tt.want) { //nolint:govet
t.Errorf("CreateMinScoreResult() = %v, want %v", got, cmp.Diff(got, tt.want))
}
})
Expand Down Expand Up @@ -427,6 +436,7 @@ func TestCreateInconclusiveResult(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := CreateInconclusiveResult(tt.args.name, tt.args.reason); !cmp.Equal(got, tt.want) {
Expand Down Expand Up @@ -463,10 +473,11 @@ func TestCreateRuntimeErrorResult(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := CreateRuntimeErrorResult(tt.args.name, tt.args.e); !reflect.DeepEqual(got, tt.want) { //nolint:govet
t.Errorf("CreateRuntimeErrorResult() = %v, want %v", got, cmp.Diff(got, tt.want)) //nolint:govet
if got := CreateRuntimeErrorResult(tt.args.name, tt.args.e); !reflect.DeepEqual(got, tt.want) {
t.Errorf("CreateRuntimeErrorResult() = %v, want %v", got, cmp.Diff(got, tt.want))
}
})
}
Expand Down

0 comments on commit cff053b

Please sign in to comment.