Skip to content

Commit

Permalink
dev: fix typos (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear authored Jul 26, 2024
1 parent 38fbb5d commit eeba613
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions analyzer/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type analyzer struct {
mu sync.RWMutex
handler validator
err error
diabledNolint bool
disabledNolint bool

found []analysis.Diagnostic
}
Expand Down Expand Up @@ -63,7 +63,7 @@ func (a *analyzer) run(pass *analysis.Pass) (interface{}, error) {
}

// 003. Is it allowed to be checked?
if !a.diabledNolint && hasDisallowDirective(f.Doc) {
if !a.disabledNolint && hasDisallowDirective(f.Doc) {
return
}

Expand Down Expand Up @@ -115,7 +115,7 @@ func (a *analyzer) readConfiguration(fs *flag.FlagSet) {
// First: checking nonolint directive
val := fs.Lookup("nonolint")
if val != nil {
a.diabledNolint = fs.Lookup("nonolint").Value.String() == "true"
a.disabledNolint = fs.Lookup("nonolint").Value.String() == "true"
}

// Second: validators implementation next
Expand Down
10 changes: 5 additions & 5 deletions analyzer/analyzer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func TestAll(t *testing.T) {

tests = append(tests, testCase{
name: "anonymous Interface/allow",
mask: []string{"anonymous_interafce.go", "go.*"},
mask: []string{"anonymous_interface.go", "go.*"},
meta: map[string]string{
"allow": types.NameAnon,
},
Expand All @@ -80,12 +80,12 @@ func TestAll(t *testing.T) {

tests = append(tests, testCase{
name: "anonymous Interface/reject",
mask: []string{"anonymous_interafce.go", "go.*"},
mask: []string{"anonymous_interface.go", "go.*"},
meta: map[string]string{
"reject": types.NameAnon,
},
want: []string{
"NewanonymousInterface returns interface (anonymous interface)",
"NewAnonymousInterface returns interface (anonymous interface)",
},
})

Expand Down Expand Up @@ -278,7 +278,7 @@ func TestAll(t *testing.T) {
"allow": types.NameStdLib, // allow only interfaces from standard library (e.g. io.Writer, fmt.Stringer)
},
want: []string{
"NewanonymousInterface returns interface (anonymous interface)",
"NewAnonymousInterface returns interface (anonymous interface)",
"dissAllowDirective2 returns interface (interface{})",
"dissAllowDirective6 returns interface (interface{})",
"fooInterface returns interface (interface{})",
Expand Down Expand Up @@ -333,7 +333,7 @@ func TestAll(t *testing.T) {
"allow": types.NameGeneric, // allow only generic interfaces
},
want: []string{
"NewanonymousInterface returns interface (anonymous interface)",
"NewAnonymousInterface returns interface (anonymous interface)",
"dissAllowDirective2 returns interface (interface{})",
"dissAllowDirective6 returns interface (interface{})",
"fooInterface returns interface (interface{})",
Expand Down
2 changes: 1 addition & 1 deletion analyzer/internal/config/allow.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package config

import "github.com/butuzov/ireturn/analyzer/internal/types"

// allowConfig specifies a list of interfaces (keywords, patters and regular expressions)
// allowConfig specifies a list of interfaces (keywords, patterns and regular expressions)
// that are allowed by ireturn as valid to return, any non listed interface are rejected.
type allowConfig struct {
*defaultConfig
Expand Down
2 changes: 1 addition & 1 deletion analyzer/internal/config/reject.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package config

import "github.com/butuzov/ireturn/analyzer/internal/types"

// rejectConfig specifies a list of interfaces (keywords, patters and regular expressions)
// rejectConfig specifies a list of interfaces (keywords, patterns and regular expressions)
// that are rejected by ireturn as valid to return, any non listed interface are allowed.
type rejectConfig struct {
*defaultConfig
Expand Down
2 changes: 1 addition & 1 deletion analyzer/std_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func Test_isStdLib(t *testing.T) {
t.Run(name, func(t *testing.T) {
got := isStdPkgInterface(name)
assert.Equal(t, got, want,
"pkg %s doens't match expectations (got %v vs want %v)", name, got, want)
"pkg %s doesn't match expectations (got %v vs want %v)", name, got, want)
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type _t_anon_interface int

func (t *_t_anon_interface) Do() {}

func NewanonymousInterface() interface {
func NewAnonymousInterface() interface {
Do()
} {
t := _t_anon_interface(1)
Expand Down
6 changes: 3 additions & 3 deletions analyzer/testdata/named_interfaces_simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ package example
type (
iDoer interface{}
iDoerAny any
iDoerConcreat int
iDoerSpecific int
)

func newIDoer() iDoer {
return iDoerConcreat(0)
return iDoerSpecific(0)
}

func newIDoerAny() iDoerAny {
return iDoerConcreat(0)
return iDoerSpecific(0)
}

type Fooer interface {
Expand Down

0 comments on commit eeba613

Please sign in to comment.