Skip to content

Commit 27a034c

Browse files
committed
fix goreportcard warnings
1 parent 9ac753f commit 27a034c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+83
-67
lines changed

Diff for: blame_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"github.com/go-git/go-git/v5/plumbing"
55
"github.com/go-git/go-git/v5/plumbing/object"
66

7+
fixtures "github.com/go-git/go-git-fixtures/v4"
78
. "gopkg.in/check.v1"
8-
"github.com/go-git/go-git-fixtures/v4"
99
)
1010

1111
type BlameSuite struct {

Diff for: config/branch_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
package config
22

33
import (
4-
. "gopkg.in/check.v1"
54
"github.com/go-git/go-git/v5/plumbing"
5+
6+
. "gopkg.in/check.v1"
67
)
78

89
type BranchSuite struct{}

Diff for: internal/revision/parser_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ func (s *ParserSuite) TestParseWithValidExpression(c *C) {
9696
TildePath{3},
9797
},
9898
"@{2016-12-16T21:42:47Z}": []Revisioner{AtDate{tim}},
99-
"@{1}": []Revisioner{AtReflog{1}},
100-
"@{-1}": []Revisioner{AtCheckout{1}},
99+
"@{1}": []Revisioner{AtReflog{1}},
100+
"@{-1}": []Revisioner{AtCheckout{1}},
101101
"master@{upstream}": []Revisioner{
102102
Ref("master"),
103103
AtUpstream{},
@@ -211,12 +211,12 @@ func (s *ParserSuite) TestParseAtWithValidExpression(c *C) {
211211
tim, _ := time.Parse("2006-01-02T15:04:05Z", "2016-12-16T21:42:47Z")
212212

213213
datas := map[string]Revisioner{
214-
"": Ref("HEAD"),
215-
"{1}": AtReflog{1},
216-
"{-1}": AtCheckout{1},
217-
"{push}": AtPush{},
218-
"{upstream}": AtUpstream{},
219-
"{u}": AtUpstream{},
214+
"": Ref("HEAD"),
215+
"{1}": AtReflog{1},
216+
"{-1}": AtCheckout{1},
217+
"{push}": AtPush{},
218+
"{upstream}": AtUpstream{},
219+
"{u}": AtUpstream{},
220220
"{2016-12-16T21:42:47Z}": AtDate{tim},
221221
}
222222

Diff for: plumbing/format/commitgraph/commitgraph_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import (
66
"path"
77
"testing"
88

9-
. "gopkg.in/check.v1"
10-
fixtures "github.com/go-git/go-git-fixtures/v4"
119
"github.com/go-git/go-git/v5/plumbing"
1210
"github.com/go-git/go-git/v5/plumbing/format/commitgraph"
11+
12+
fixtures "github.com/go-git/go-git-fixtures/v4"
13+
. "gopkg.in/check.v1"
1314
)
1415

1516
func Test(t *testing.T) { TestingT(t) }

Diff for: plumbing/format/idxfile/encoder_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66

77
. "github.com/go-git/go-git/v5/plumbing/format/idxfile"
88

9+
fixtures "github.com/go-git/go-git-fixtures/v4"
910
. "gopkg.in/check.v1"
10-
"github.com/go-git/go-git-fixtures/v4"
1111
)
1212

1313
func (s *IdxfileSuite) TestDecodeEncode(c *C) {

Diff for: plumbing/format/idxfile/idxfile_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import (
1010
"github.com/go-git/go-git/v5/plumbing"
1111
"github.com/go-git/go-git/v5/plumbing/format/idxfile"
1212

13+
fixtures "github.com/go-git/go-git-fixtures/v4"
1314
. "gopkg.in/check.v1"
14-
"github.com/go-git/go-git-fixtures/v4"
1515
)
1616

1717
func BenchmarkFindOffset(b *testing.B) {

Diff for: plumbing/format/idxfile/writer_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
"github.com/go-git/go-git/v5/plumbing/format/idxfile"
1010
"github.com/go-git/go-git/v5/plumbing/format/packfile"
1111

12+
fixtures "github.com/go-git/go-git-fixtures/v4"
1213
. "gopkg.in/check.v1"
13-
"github.com/go-git/go-git-fixtures/v4"
1414
)
1515

1616
type WriterSuite struct {

Diff for: plumbing/format/index/decoder.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,9 @@ func (d *treeExtensionDecoder) readEntry() (*TreeEntry, error) {
390390

391391
e.Trees = i
392392
_, err = io.ReadFull(d.r, e.Hash[:])
393-
393+
if err != nil {
394+
return nil, err
395+
}
394396
return e, nil
395397
}
396398

Diff for: plumbing/format/index/encoder_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import (
55
"strings"
66
"time"
77

8+
"github.com/go-git/go-git/v5/plumbing"
9+
810
"github.com/google/go-cmp/cmp"
911
. "gopkg.in/check.v1"
10-
"github.com/go-git/go-git/v5/plumbing"
1112
)
1213

1314
func (s *IndexSuite) TestEncode(c *C) {

Diff for: plumbing/format/objfile/common_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import (
44
"encoding/base64"
55
"testing"
66

7-
. "gopkg.in/check.v1"
87
"github.com/go-git/go-git/v5/plumbing"
8+
9+
. "gopkg.in/check.v1"
910
)
1011

1112
type objfileFixture struct {

Diff for: plumbing/format/objfile/writer_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import (
66
"fmt"
77
"io"
88

9-
. "gopkg.in/check.v1"
109
"github.com/go-git/go-git/v5/plumbing"
10+
11+
. "gopkg.in/check.v1"
1112
)
1213

1314
type SuiteWriter struct{}

Diff for: plumbing/format/packfile/encoder_advanced_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ import (
66
"math/rand"
77
"testing"
88

9-
"github.com/go-git/go-billy/v5/memfs"
109
"github.com/go-git/go-git/v5/plumbing"
1110
"github.com/go-git/go-git/v5/plumbing/cache"
1211
"github.com/go-git/go-git/v5/plumbing/format/idxfile"
1312
. "github.com/go-git/go-git/v5/plumbing/format/packfile"
1413
"github.com/go-git/go-git/v5/plumbing/storer"
1514
"github.com/go-git/go-git/v5/storage/filesystem"
1615

16+
"github.com/go-git/go-billy/v5/memfs"
17+
fixtures "github.com/go-git/go-git-fixtures/v4"
1718
. "gopkg.in/check.v1"
18-
"github.com/go-git/go-git-fixtures/v4"
1919
)
2020

2121
type EncoderAdvancedSuite struct {

Diff for: plumbing/format/packfile/encoder_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import (
55
"io"
66
stdioutil "io/ioutil"
77

8-
"github.com/go-git/go-billy/v5/memfs"
98
"github.com/go-git/go-git/v5/plumbing"
109
"github.com/go-git/go-git/v5/plumbing/format/idxfile"
1110
"github.com/go-git/go-git/v5/storage/memory"
1211

12+
"github.com/go-git/go-billy/v5/memfs"
13+
fixtures "github.com/go-git/go-git-fixtures/v4"
1314
. "gopkg.in/check.v1"
14-
"github.com/go-git/go-git-fixtures/v4"
1515
)
1616

1717
type EncoderSuite struct {

Diff for: plumbing/format/packfile/patch_delta.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ func ApplyDelta(target, base plumbing.EncodedObject, delta []byte) (err error) {
4949
return err
5050
}
5151

52-
5352
target.SetSize(int64(dst.Len()))
5453

5554
b := byteSlicePool.Get().([]byte)
@@ -113,7 +112,7 @@ func patchDelta(dst *bytes.Buffer, src, delta []byte) error {
113112
invalidOffsetSize(offset, sz, srcSz) {
114113
break
115114
}
116-
dst.Write(src[offset:offset+sz])
115+
dst.Write(src[offset : offset+sz])
117116
remainingTargetSz -= sz
118117
} else if isCopyFromDelta(cmd) {
119118
sz := uint(cmd) // cmd is the size itself

Diff for: plumbing/object/commit_stats_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ import (
1111

1212
"github.com/go-git/go-billy/v5/memfs"
1313
"github.com/go-git/go-billy/v5/util"
14+
15+
fixtures "github.com/go-git/go-git-fixtures/v4"
1416
. "gopkg.in/check.v1"
15-
"github.com/go-git/go-git-fixtures/v4"
1617
)
1718

1819
type CommitStatsSuite struct {

Diff for: plumbing/object/commit_walker_bfs_filtered.go

-1
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,3 @@ func (w *filterCommitIter) addToQueue(
173173

174174
return nil
175175
}
176-

Diff for: plumbing/object/commit_walker_path.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"io"
55

66
"github.com/go-git/go-git/v5/plumbing"
7-
87
"github.com/go-git/go-git/v5/plumbing/storer"
98
)
109

@@ -29,7 +28,7 @@ func NewCommitPathIterFromIter(pathFilter func(string) bool, commitIter CommitIt
2928
return iterator
3029
}
3130

32-
// this function is kept for compatibilty, can be replaced with NewCommitPathIterFromIter
31+
// NewCommitFileIterFromIter is kept for compatibility, can be replaced with NewCommitPathIterFromIter
3332
func NewCommitFileIterFromIter(fileName string, commitIter CommitIter, checkParent bool) CommitIter {
3433
return NewCommitPathIterFromIter(
3534
func(path string) bool {

Diff for: plumbing/object/commitgraph/commitnode_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ import (
44
"path"
55
"testing"
66

7-
. "gopkg.in/check.v1"
8-
fixtures "github.com/go-git/go-git-fixtures/v4"
97
"github.com/go-git/go-git/v5/plumbing"
108
"github.com/go-git/go-git/v5/plumbing/cache"
119
"github.com/go-git/go-git/v5/plumbing/format/commitgraph"
1210
"github.com/go-git/go-git/v5/plumbing/format/packfile"
1311
"github.com/go-git/go-git/v5/storage/filesystem"
12+
13+
fixtures "github.com/go-git/go-git-fixtures/v4"
14+
. "gopkg.in/check.v1"
1415
)
1516

1617
func Test(t *testing.T) { TestingT(t) }

Diff for: plumbing/object/commitgraph/commitnode_walker_ctime.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package commitgraph
33
import (
44
"io"
55

6-
"github.com/emirpasic/gods/trees/binaryheap"
7-
86
"github.com/go-git/go-git/v5/plumbing"
97
"github.com/go-git/go-git/v5/plumbing/storer"
8+
9+
"github.com/emirpasic/gods/trees/binaryheap"
1010
)
1111

1212
type commitNodeIteratorByCTime struct {

Diff for: plumbing/object/patch_test.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package object
22

33
import (
4-
. "gopkg.in/check.v1"
5-
fixtures "github.com/go-git/go-git-fixtures/v4"
64
"github.com/go-git/go-git/v5/plumbing"
75
"github.com/go-git/go-git/v5/plumbing/cache"
86
"github.com/go-git/go-git/v5/storage/filesystem"
7+
8+
fixtures "github.com/go-git/go-git-fixtures/v4"
9+
. "gopkg.in/check.v1"
910
)
1011

1112
type PatchSuite struct {

Diff for: plumbing/object/rename.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ var errIndexFull = errors.New("index is full")
536536
// between two files.
537537
// To save space in memory, this index uses a space efficient encoding which
538538
// will not exceed 1MiB per instance. The index starts out at a smaller size
539-
// (closer to 2KiB), but may grow as more distinct blocks withing the scanned
539+
// (closer to 2KiB), but may grow as more distinct blocks within the scanned
540540
// file are discovered.
541541
// see: https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityIndex.java
542542
type similarityIndex struct {
@@ -709,7 +709,7 @@ func (i *similarityIndex) common(dst *similarityIndex) uint64 {
709709
}
710710

711711
func (i *similarityIndex) add(key int, cnt uint64) error {
712-
key = int(uint32(key)*0x9e370001 >> 1)
712+
key = int(uint32(key) * 0x9e370001 >> 1)
713713

714714
j := i.slot(key)
715715
for {
@@ -769,7 +769,7 @@ func (i *similarityIndex) slot(key int) int {
769769
// We use 31 - hashBits because the upper bit was already forced
770770
// to be 0 and we want the remaining high bits to be used as the
771771
// table slot.
772-
return int(uint32(key) >> uint(31 - i.hashBits))
772+
return int(uint32(key) >> uint(31-i.hashBits))
773773
}
774774

775775
func shouldGrowAt(hashBits int) int {

Diff for: plumbing/protocol/packp/uppackresp_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"bytes"
55
"io/ioutil"
66

7+
"github.com/go-git/go-git/v5/plumbing"
78
"github.com/go-git/go-git/v5/plumbing/protocol/packp/capability"
89

910
. "gopkg.in/check.v1"
10-
"github.com/go-git/go-git/v5/plumbing"
1111
)
1212

1313
type UploadPackResponseSuite struct{}

Diff for: plumbing/storer/object_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import (
44
"fmt"
55
"testing"
66

7-
. "gopkg.in/check.v1"
87
"github.com/go-git/go-git/v5/plumbing"
8+
9+
. "gopkg.in/check.v1"
910
)
1011

1112
func Test(t *testing.T) { TestingT(t) }

Diff for: plumbing/storer/reference_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import (
44
"errors"
55
"io"
66

7-
. "gopkg.in/check.v1"
87
"github.com/go-git/go-git/v5/plumbing"
8+
9+
. "gopkg.in/check.v1"
910
)
1011

1112
type ReferenceSuite struct{}

Diff for: plumbing/transport/git/common_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313

1414
"github.com/go-git/go-git/v5/plumbing/transport"
1515

16+
fixtures "github.com/go-git/go-git-fixtures/v4"
1617
. "gopkg.in/check.v1"
17-
"github.com/go-git/go-git-fixtures/v4"
1818
)
1919

2020
func Test(t *testing.T) { TestingT(t) }

Diff for: plumbing/transport/git/receive_pack_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package git
33
import (
44
"github.com/go-git/go-git/v5/plumbing/transport/test"
55

6+
fixtures "github.com/go-git/go-git-fixtures/v4"
67
. "gopkg.in/check.v1"
7-
"github.com/go-git/go-git-fixtures/v4"
88
)
99

1010
type ReceivePackSuite struct {

Diff for: plumbing/transport/http/common_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import (
1717

1818
"github.com/go-git/go-git/v5/plumbing/transport"
1919

20+
fixtures "github.com/go-git/go-git-fixtures/v4"
2021
. "gopkg.in/check.v1"
21-
"github.com/go-git/go-git-fixtures/v4"
2222
)
2323

2424
func Test(t *testing.T) { TestingT(t) }

Diff for: plumbing/transport/http/receive_pack_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package http
33
import (
44
"github.com/go-git/go-git/v5/plumbing/transport/test"
55

6+
fixtures "github.com/go-git/go-git-fixtures/v4"
67
. "gopkg.in/check.v1"
7-
"github.com/go-git/go-git-fixtures/v4"
88
)
99

1010
type ReceivePackSuite struct {

Diff for: plumbing/transport/http/upload_pack_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
"github.com/go-git/go-git/v5/plumbing/transport"
1212
"github.com/go-git/go-git/v5/plumbing/transport/test"
1313

14+
fixtures "github.com/go-git/go-git-fixtures/v4"
1415
. "gopkg.in/check.v1"
15-
"github.com/go-git/go-git-fixtures/v4"
1616
)
1717

1818
type UploadPackSuite struct {

Diff for: plumbing/transport/server/receive_pack_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,5 @@ func (s *ReceivePackSuite) TestReceivePackWithNilPackfile(c *C) {
6060

6161
report, err := r.ReceivePack(context.Background(), req)
6262
c.Assert(report, IsNil, comment)
63+
c.Assert(err, IsNil, comment)
6364
}

0 commit comments

Comments
 (0)