Skip to content

Commit

Permalink
chore: Disable buggy ireturn linter
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Apr 29, 2024
1 parent a5a982f commit a49a7e0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 32 deletions.
23 changes: 1 addition & 22 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ linters:
- inamedparam
- ineffassign
- interfacebloat
- ireturn
- loggercheck
- makezero
- mirror
Expand Down Expand Up @@ -95,6 +94,7 @@ linters:
- goheader
- gomnd
- gomoddirectives
- ireturn
- lll
- maintidx
- maligned
Expand Down Expand Up @@ -134,27 +134,6 @@ linters-settings:
- fieldalignment
- shadow
enable-all: true
ireturn:
allow:
- anon
- comparable
- empty
- error
- github\.com/charmbracelet/bubbletea\.Model
- github\.com/charmbracelet/bubbletea\.Msg
- github\.com/go-git/go-git/v5/plumbing/format/diff\.File
- github\.com/go-git/go-git/v5/plumbing/format/diff\.Patch
- github\.com/mitchellh/mapstructure\.DecodeHookFunc
- github\.com/twpayne/chezmoi/v2/internal/chezmoi\.ActualStateEntry
- github\.com/twpayne/chezmoi/v2/internal/chezmoi\.Encryption
- github\.com/twpayne/chezmoi/v2/internal/chezmoi\.Format
- github\.com/twpayne/chezmoi/v2/internal/chezmoi\.PersistentState
- github\.com/twpayne/chezmoi/v2/internal/chezmoi\.SourceStateOrigin
- github\.com/twpayne/chezmoi/v2/internal/chezmoi\.SourceStateEntry
- github\.com/twpayne/chezmoi/v2/internal/chezmoi\.System
- github\.com/twpayne/chezmoi/v2/internal/chezmoi\.TargetStateEntry
- github\.com/twpayne/go-vfs/v5\.FS
- stdlib
misspell:
locale: US
stylecheck:
Expand Down
10 changes: 3 additions & 7 deletions internal/chezmoibubbles/chezmoibubbles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var keyTypes = chezmoiset.New(
tea.KeyEsc,
)

func makeKeyMsg(r rune) tea.Msg { //nolint:ireturn,nolintlint
func makeKeyMsg(r rune) tea.Msg {
key := tea.Key{
Type: tea.KeyRunes,
Runes: []rune{r},
Expand All @@ -28,19 +28,15 @@ func makeKeyMsg(r rune) tea.Msg { //nolint:ireturn,nolintlint
return tea.KeyMsg(key)
}

func makeKeyMsgs(s string) []tea.Msg { //nolint:ireturn,nolintlint
func makeKeyMsgs(s string) []tea.Msg {
msgs := make([]tea.Msg, 0, len(s))
for _, r := range s {
msgs = append(msgs, makeKeyMsg(r))
}
return msgs
}

func testRunModelWithInput[M tea.Model]( //nolint:ireturn,nolintlint
t *testing.T,
model M,
input string,
) M {
func testRunModelWithInput[M tea.Model](t *testing.T, model M, input string) M {
t.Helper()
for _, msg := range makeKeyMsgs(input) {
m, _ := model.Update(msg)
Expand Down
2 changes: 1 addition & 1 deletion internal/chezmoiset/chezmoiset.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (s Set[T]) AddSet(other Set[T]) {

// AnyElement returns an arbitrary element from s. It is typically used when s
// is known to contain exactly one element.
func (s Set[T]) AnyElement() T { //nolint:ireturn
func (s Set[T]) AnyElement() T {
for element := range s {
return element
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ type cancelableModel interface {
Canceled() bool
}

func runCancelableModel[M cancelableModel](initModel M) (M, error) { //nolint:ireturn,nolintlint
func runCancelableModel[M cancelableModel](initModel M) (M, error) {
switch finalModel, err := runModel(initModel); {
case err != nil:
return finalModel, err
Expand All @@ -252,7 +252,7 @@ func runCancelableModel[M cancelableModel](initModel M) (M, error) { //nolint:ir
}
}

func runModel[M tea.Model](initModel M) (M, error) { //nolint:ireturn,nolintlint
func runModel[M tea.Model](initModel M) (M, error) {
program := tea.NewProgram(initModel)
finalModel, err := program.Run()
return finalModel.(M), err //nolint:forcetypeassert
Expand Down

0 comments on commit a49a7e0

Please sign in to comment.