Skip to content

Commit

Permalink
chore: update lint to 1.56.2 and fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
plastikfan committed Apr 27, 2024
1 parent cadb1f8 commit 9d0f461
Show file tree
Hide file tree
Showing 45 changed files with 131 additions and 125 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
version: v1.56.2
args: --verbose

test:
Expand Down
4 changes: 2 additions & 2 deletions collections/collections-suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package collections_test
import (
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
)

func TestCollections(t *testing.T) {
Expand Down
4 changes: 1 addition & 3 deletions collections/gomega-stack-matchers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ package collections_test
import (
"fmt"

// . "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
// . "github.com/onsi/gomega/matchers"
. "github.com/onsi/gomega" //nolint:revive // gomega ok

"github.com/onsi/gomega/types"
"github.com/snivilised/extendio/collections"
Expand Down
12 changes: 6 additions & 6 deletions collections/iterators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
"github.com/samber/lo"

"github.com/snivilised/extendio/collections"
Expand Down Expand Up @@ -635,7 +635,7 @@ var _ = Describe("Iterators", func() {

return nil
}
while := func(_ sleeve, err error) bool {
while := func(_ sleeve, _ error) bool {
return true
}

Expand All @@ -658,7 +658,7 @@ var _ = Describe("Iterators", func() {

return nil
}
while := func(s sleeve, err error) bool {
while := func(s sleeve, _ error) bool {
return strings.HasPrefix(s.song(), "0")
}

Expand All @@ -683,7 +683,7 @@ var _ = Describe("Iterators", func() {

return nil
}
while := func(_ sleeve, err error) bool {
while := func(_ sleeve, _ error) bool {
return true
}

Expand All @@ -706,7 +706,7 @@ var _ = Describe("Iterators", func() {

return nil
}
while := func(s sleeve, err error) bool {
while := func(s sleeve, _ error) bool {
return strings.HasPrefix(s.song(), "BONUS")
}

Expand Down
4 changes: 2 additions & 2 deletions collections/stack_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package collections_test

import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok

"github.com/snivilised/extendio/collections"
)
Expand Down
4 changes: 2 additions & 2 deletions i18n/i18n_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package i18n_test
import (
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
)

func TestI18n(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions i18n/text_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"errors"
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
xi18n "github.com/snivilised/extendio/i18n"
"github.com/snivilised/extendio/internal/helpers"
"github.com/snivilised/extendio/xfs/utils"
Expand Down
4 changes: 2 additions & 2 deletions i18n/translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
"golang.org/x/text/language"

"github.com/snivilised/extendio/i18n"
Expand Down
4 changes: 2 additions & 2 deletions xfs/nav/bootstrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ func (b *bootstrapper) initFilters() {

func (b *bootstrapper) initNotifiers() {
if b.o.Notify.OnStart == nil {
b.o.Notify.OnStart = func(description string) {}
b.o.Notify.OnStart = func(_ string) {}
}

if b.o.Notify.OnStop == nil {
b.o.Notify.OnStop = func(description string) {}
b.o.Notify.OnStop = func(_ string) {}
}

b.nc.frame.notifiers.init(&b.o.Notify)
Expand Down
6 changes: 3 additions & 3 deletions xfs/nav/filter-extended-glob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package nav_test
import (
"fmt"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
"github.com/samber/lo"

"github.com/snivilised/extendio/internal/helpers"

. "github.com/snivilised/extendio/i18n"
. "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok
"github.com/snivilised/extendio/xfs/nav"
)

Expand Down
2 changes: 1 addition & 1 deletion xfs/nav/filter-glob.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type CompoundGlobFilter struct {
// Matching returns the collection of files contained within this
// item's folder that matches this filter.
func (f *CompoundGlobFilter) Matching(children []fs.DirEntry) []fs.DirEntry {
return lo.Filter(children, func(entry fs.DirEntry, index int) bool {
return lo.Filter(children, func(entry fs.DirEntry, _ int) bool {
matched, _ := filepath.Match(f.Pattern, entry.Name())
return f.invert(matched)
})
Expand Down
6 changes: 3 additions & 3 deletions xfs/nav/filter-glob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package nav_test
import (
"fmt"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
"github.com/samber/lo"

"github.com/snivilised/extendio/internal/helpers"

. "github.com/snivilised/extendio/i18n"
. "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok
"github.com/snivilised/extendio/xfs/nav"
)

Expand Down
8 changes: 4 additions & 4 deletions xfs/nav/filter-poly_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"fmt"
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
"github.com/samber/lo"

. "github.com/snivilised/extendio/i18n"
. "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok
"github.com/snivilised/extendio/internal/helpers"
"github.com/snivilised/extendio/xfs/nav"
)
Expand Down Expand Up @@ -356,7 +356,7 @@ var _ = Describe("FilterPoly", Ordered, func() {
o.Store.FilterDefs = filterDefs
o.Callback = &nav.LabelledTraverseCallback{
Label: "(panic): test poly filter callback",
Fn: func(item *nav.TraverseItem) error {
Fn: func(_ *nav.TraverseItem) error {
return nil
},
}
Expand Down
2 changes: 1 addition & 1 deletion xfs/nav/filter-regex.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (f *CompoundRegexFilter) Validate() {
}

func (f *CompoundRegexFilter) Matching(children []fs.DirEntry) []fs.DirEntry {
return lo.Filter(children, func(entry fs.DirEntry, index int) bool {
return lo.Filter(children, func(entry fs.DirEntry, _ int) bool {
return f.invert(f.rex.MatchString(entry.Name()))
})
}
6 changes: 3 additions & 3 deletions xfs/nav/filter-regex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"fmt"
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
"github.com/samber/lo"

"github.com/snivilised/extendio/internal/helpers"

. "github.com/snivilised/extendio/i18n"
. "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok
"github.com/snivilised/extendio/xfs/nav"
)

Expand Down
2 changes: 1 addition & 1 deletion xfs/nav/gomega-matchers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package nav_test
import (
"fmt"

. "github.com/onsi/gomega/types"
. "github.com/onsi/gomega/types" //nolint:revive // gomega ok
"github.com/snivilised/extendio/xfs/nav"
)

Expand Down
4 changes: 2 additions & 2 deletions xfs/nav/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"path/filepath"
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
"github.com/samber/lo"
"github.com/snivilised/extendio/i18n"
"github.com/snivilised/extendio/internal/helpers"
Expand Down
2 changes: 2 additions & 0 deletions xfs/nav/hook-extend.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ func DefaultExtendHookFn(navi *NavigationInfo, entries *DirectoryContents) {
func() string {
result := subpath
sep := string(filepath.Separator)

if strings.HasSuffix(subpath, sep) {
result = subpath[:strings.LastIndex(subpath, sep)]
}

return result
},
)
Expand Down
8 changes: 4 additions & 4 deletions xfs/nav/marshal-state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"fmt"
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok

"github.com/snivilised/extendio/internal/helpers"

. "github.com/snivilised/extendio/i18n"
. "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok
"github.com/snivilised/extendio/xfs/nav"
)

Expand Down Expand Up @@ -98,7 +98,7 @@ var _ = Describe("MarshalOptions", Ordered, func() {
o.Store.FilterDefs = &filterDefs
o.Callback = &nav.LabelledTraverseCallback{
Label: "test marshal state callback",
Fn: func(item *nav.TraverseItem) error {
Fn: func(_ *nav.TraverseItem) error {
return nil
},
}
Expand Down
4 changes: 2 additions & 2 deletions xfs/nav/nav-suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package nav_test
import (
"testing"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
)

func TestNav(t *testing.T) {
Expand Down
6 changes: 3 additions & 3 deletions xfs/nav/navigation-async_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"time"

"github.com/fortytw2/leaktest"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
"github.com/samber/lo"
"go.uber.org/zap/exp/zapslog"
"go.uber.org/zap/zapcore"
Expand All @@ -17,7 +17,7 @@ import (
"github.com/snivilised/extendio/xfs/nav"
"github.com/snivilised/lorax/boost"

. "github.com/snivilised/extendio/i18n"
. "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok
)

var (
Expand Down
6 changes: 3 additions & 3 deletions xfs/nav/navigation-listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"fmt"
"strings"

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
"github.com/samber/lo"
"github.com/snivilised/extendio/internal/helpers"

. "github.com/snivilised/extendio/i18n"
. "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok
"github.com/snivilised/extendio/xfs/nav"
)

Expand Down
6 changes: 3 additions & 3 deletions xfs/nav/navigation-with-runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import (
"time"

"github.com/fortytw2/leaktest"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
. "github.com/onsi/gomega" //nolint:revive // gomega ok
"go.uber.org/zap/exp/zapslog"
"go.uber.org/zap/zapcore"

"github.com/snivilised/extendio/internal/helpers"
"github.com/snivilised/extendio/xfs/nav"
"github.com/snivilised/lorax/boost"

. "github.com/snivilised/extendio/i18n"
. "github.com/snivilised/extendio/i18n" //nolint:revive // i18n ok
)

var _ = Describe("NavigationWithRunner", Ordered, func() {
Expand Down
2 changes: 1 addition & 1 deletion xfs/nav/new-filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func fromExtendedGlobPattern(pattern string) (segments, suffixes []string, err e
segments = strings.Split(pattern, "|")
suffixes = strings.Split(segments[1], ",")

suffixes = lo.Reject(suffixes, func(item string, index int) bool {
suffixes = lo.Reject(suffixes, func(item string, _ int) bool {
return item == ""
})

Expand Down
2 changes: 1 addition & 1 deletion xfs/nav/read-entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func ReadEntriesHookFn(dirname string) ([]fs.DirEntry, error) {
return nil, err
}

return lo.Filter(contents, func(item fs.DirEntry, index int) bool {
return lo.Filter(contents, func(item fs.DirEntry, _ int) bool {
return item.Name() != ".DS_Store"
}), nil
}
1 change: 1 addition & 0 deletions xfs/nav/resume-strategy-spawn.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func (s *spawnStrategy) following(params *followingParams) *shard {
if params.inclusive {
return item.Name() >= params.anchor
}

return item.Name() > params.anchor
})
siblings := groups[followingSiblings]
Expand Down
Loading

0 comments on commit 9d0f461

Please sign in to comment.