···77 - internal/compress/flate
88 - internal/compress/internal
99 disable:
1010- - depguard # not sensible for us
1110 - dupword # extremely normal in tests and a pretty unnecessary linter
1211 - goconst # unnecessary especially for our parsing code; many false positives
1313- - mnd # same as above
1414- - lll # poor standard
1515- - ireturn # not an issue
1616- - perfsprint # silly fmt.Errorf vs errors.New suggestion
1212+ - mnd # unnecessary especially for our parsing code; many false positives
1313+ - lll # common sense is much better than these sort of rules
1714 - gosmopolitan # completely normal to have CJK and such in tests
1818- - gochecknoglobals # unlikely to be introduce accidentally and are usually intentional
1915 - nonamedreturns # named returns are often good for clarity
2020- - errname # ErrXXX is better than XXXError
2116 - wsl # outdated, use wsl_v5 instead
2217 - varnamelen # it's rather reasonable to have counters like i, even when it spans quite a bit
2318 - gocyclo # cyclomatic metrics aren't that good
···3126 - gocognit # tmp: should consider sometime
32273328 settings:
2929+ perfsprint:
3030+ errorf: false
3131+ depguard:
3232+ rules:
3333+ Main:
3434+ list-mode: strict
3535+ files:
3636+ - $all
3737+ allow:
3838+ - $gostd
3939+ - codeberg.org/lindenii/furgit
4040+ - golang.org/x
3441 gosec:
3542 excludes:
3643 - G301 # UNIX permissions
+4-4
format/commitgraph/read/bloom.go
···38383939// BloomFilterAt returns one commit's changed-path Bloom filter.
4040//
4141-// Returns ErrBloomUnavailable when this commit graph has no Bloom data.
4141+// Returns BloomUnavailableError when this commit graph has no Bloom data.
4242func (reader *Reader) BloomFilterAt(pos Position) (*bloom.Filter, error) {
4343 layer, err := reader.layerByPosition(pos)
4444 if err != nil {
···4646 }
47474848 if layer.chunkBloomIndex == nil || layer.chunkBloomData == nil || layer.bloomSettings == nil {
4949- return nil, &ErrBloomUnavailable{Pos: pos}
4949+ return nil, &BloomUnavailableError{Pos: pos}
5050 }
51515252 start, end, err := bloomRange(layer, pos.Index)
···8686 }
87878888 if end < start {
8989- return 0, 0, &ErrMalformed{Path: layer.path, Reason: "invalid BIDX range"}
8989+ return 0, 0, &MalformedError{Path: layer.path, Reason: "invalid BIDX range"}
9090 }
91919292 bdatLen := len(layer.chunkBloomData) - bloom.DataHeaderSize
···9797 }
98989999 if end > bdatLenU32 {
100100- return 0, 0, &ErrMalformed{Path: layer.path, Reason: "BIDX range out of BDAT bounds"}
100100+ return 0, 0, &MalformedError{Path: layer.path, Reason: "BIDX range out of BDAT bounds"}
101101 }
102102103103 startInt, err := intconv.Uint64ToInt(uint64(start))
+2-2
format/commitgraph/read/edges.go
···991010func (reader *Reader) decodeExtraEdgeList(layer *layer, edgeStart uint32) ([]Position, error) {
1111 if len(layer.chunkExtraEdges) == 0 {
1212- return nil, &ErrMalformed{Path: layer.path, Reason: "missing EDGE chunk"}
1212+ return nil, &MalformedError{Path: layer.path, Reason: "missing EDGE chunk"}
1313 }
14141515 out := make([]Position, 0)
···2424 }
25252626 if off+4 > len(layer.chunkExtraEdges) {
2727- return nil, &ErrMalformed{Path: layer.path, Reason: "EDGE index out of range"}
2727+ return nil, &MalformedError{Path: layer.path, Reason: "EDGE index out of range"}
2828 }
29293030 word := binary.BigEndian.Uint32(layer.chunkExtraEdges[off : off+4])
···1414// Size of an Adler-32 checksum in bytes.
1515const Size = 4
16161717+//nolint:gochecknoglobals
1718var hasAVX2 = cpu.X86.HasAVX2
18191920// digest represents the partial evaluation of a checksum.
···2424// Compare-to-golden test data was generated by the ZLIB example program at
2525// https://www.zlib.net/zpipe.c
26262727+//nolint:gochecknoglobals
2728var zlibTests = []zlibTest{
2829 {
2930 "truncated empty",
···1515 "codeberg.org/lindenii/furgit/internal/compress/zlib"
1616)
17171818+//nolint:gochecknoglobals
1819var filenames = []string{
1920 "../testdata/gettysburg.txt",
2021 "../testdata/e.txt",
2122 "../testdata/pi.txt",
2223}
23242525+//nolint:gochecknoglobals
2426var data = []string{
2527 "test a reasonable sized string that can be compressed",
2628}
+2
internal/lru/get.go
···11package lru
2233// Get returns value for key and marks it most-recently-used.
44+//
55+//nolint:ireturn
46func (cache *Cache[K, V]) Get(key K) (V, bool) {
57 elem, ok := cache.items[key]
68 if !ok {
+2
internal/lru/peek.go
···11package lru
2233// Peek returns value for key without changing recency.
44+//
55+//nolint:ireturn
46func (cache *Cache[K, V]) Peek(key K) (V, bool) {
57 elem, ok := cache.items[key]
68 if !ok {
+2
internal/lru/remove.go
···33import "container/list"
4455// Remove deletes key from the cache.
66+//
77+//nolint:ireturn
68func (cache *Cache[K, V]) Remove(key K) (V, bool) {
79 elem, ok := cache.items[key]
810 if !ok {
···2525}
26262727// Object returns the parsed blob as the generic object interface.
2828+//
2929+//nolint:ireturn
2830func (stored *StoredBlob) Object() object.Object {
2931 return stored.blob
3032}
+2
objectstored/commit.go
···2222}
23232424// Object returns the parsed commit as the generic object interface.
2525+//
2626+//nolint:ireturn
2527func (stored *StoredCommit) Object() object.Object {
2628 return stored.commit
2729}
+2
objectstored/objectstored.go
···2222}
23232424// Object returns the parsed tag as the generic object interface.
2525+//
2626+//nolint:ireturn
2527func (stored *StoredTag) Object() object.Object {
2628 return stored.tag
2729}
+2
objectstored/tree.go
···2222}
23232424// Object returns the parsed tree as the generic object interface.
2525+//
2626+//nolint:ireturn
2527func (stored *StoredTree) Object() object.Object {
2628 return stored.tree
2729}
+2-2
reachability/ancestor.go
···57575858 ancestorPos, err := r.graph.Lookup(ancestor)
5959 if err != nil {
6060- var notFound *commitgraphread.ErrNotFound
6060+ var notFound *commitgraphread.NotFoundError
6161 if errors.As(err, ¬Found) {
6262 return false, false, nil
6363 }
···67676868 descendantPos, err := r.graph.Lookup(descendant)
6969 if err != nil {
7070- var notFound *commitgraphread.ErrNotFound
7070+ var notFound *commitgraphread.NotFoundError
7171 if errors.As(err, ¬Found) {
7272 return false, false, nil
7373 }
+6-6
reachability/errors.go
···77 "codeberg.org/lindenii/furgit/objecttype"
88)
991010-// ErrObjectMissing indicates that a referenced object is absent from the store.
1111-type ErrObjectMissing struct {
1010+// ObjectMissingError indicates that a referenced object is absent from the store.
1111+type ObjectMissingError struct {
1212 OID objectid.ObjectID
1313}
14141515-func (e *ErrObjectMissing) Error() string {
1515+func (e *ObjectMissingError) Error() string {
1616 return fmt.Sprintf("reachability: missing object %s", e.OID)
1717}
18181919-// ErrObjectType indicates that a referenced object has a different type than
1919+// ObjectTypeError indicates that a referenced object has a different type than
2020// what traversal expected on that edge.
2121-type ErrObjectType struct {
2121+type ObjectTypeError struct {
2222 OID objectid.ObjectID
2323 Got objecttype.Type
2424 Want objecttype.Type
2525}
26262727-func (e *ErrObjectType) Error() string {
2727+func (e *ObjectTypeError) Error() string {
2828 gotName, gotOK := objecttype.Name(e.Got)
2929 if !gotOK {
3030 gotName = fmt.Sprintf("type(%d)", e.Got)
···99)
10101111// Resolve resolves a reference from the first backend that has it.
1212+//
1313+//nolint:ireturn
1214func (chain *Chain) Resolve(name string) (ref.Ref, error) {
1315 for i, backend := range chain.backends {
1416 if backend == nil {
+4
refstore/loose/resolve.go
···1212)
13131414// Resolve resolves a loose reference name to symbolic or detached form.
1515+//
1616+//nolint:ireturn
1517func (store *Store) Resolve(name string) (ref.Ref, error) {
1618 if name == "" {
1719 return nil, refstore.ErrReferenceNotFound
···6365}
64666567// resolveOne resolves one loose ref file without symbolic recursion.
6868+//
6969+//nolint:ireturn
6670func (store *Store) resolveOne(name string) (ref.Ref, error) {
6771 data, err := store.root.ReadFile(name)
6872 if err != nil {
+2
refstore/packed/resolve.go
···66)
7788// Resolve resolves a packed reference name to a detached ref.
99+//
1010+//nolint:ireturn
911func (store *Store) Resolve(name string) (ref.Ref, error) {
1012 detached, ok := store.byName[name]
1113 if !ok {