Skip to content

Commit

Permalink
Fixed code review comments.
Browse files Browse the repository at this point in the history
Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
  • Loading branch information
naveensrinivasan committed Dec 28, 2023
1 parent 44a85ae commit 05166d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pkg/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ type jsonScorecardV2 struct {

type jsonFloatScore float64

var errNoDoc = errors.New("doc is nil")

func (s jsonFloatScore) MarshalJSON() ([]byte, error) {
// Note: for integers, this will show as X.0.
return []byte(fmt.Sprintf("%.1f", s)), nil
Expand Down Expand Up @@ -148,7 +150,7 @@ func (r *ScorecardResult) AsJSON2(showDetails bool,
return sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf("GetCheck: %s: %v", checkResult.Name, e))
}
if doc == nil {
return sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf("GetCheck: %s: %v", checkResult.Name, errors.New("doc is nil")))
return sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf("GetCheck: %s: %v", checkResult.Name, errNoDoc))
}

Check warning on line 154 in pkg/json.go

View check run for this annotation

Codecov / codecov/patch

pkg/json.go#L153-L154

Added lines #L153 - L154 were not covered by tests

tmpResult := jsonCheckResultV2{
Expand Down
2 changes: 1 addition & 1 deletion pkg/sarif_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ func Test_createSARIFRuns(t *testing.T) {
want: []run{},
},
{
name: "test with nil run also",
name: "nil runs are skipped",
args: args{
runs: map[string]*run{
"run1": nil,
Expand Down

0 comments on commit 05166d0

Please sign in to comment.