Skip to content

Commit

Permalink
fix: Test care condition
Browse files Browse the repository at this point in the history
  • Loading branch information
eugercek committed Aug 13, 2023
1 parent c0dbdc5 commit 9ed226f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions noyoda.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,23 @@ Yoda condition is a expression/statement style to prevent accidental assignments
Go does not needs this check.`

//nolint:gochecknoglobals
var includeConst bool
var (
includeConst bool
flagset flag.FlagSet
)

func init() {
flagset.BoolVar(&includeConst, "include-const", false, "should include const (default is false)")
}

func NewAnalyzer() *analysis.Analyzer {
fs := flag.NewFlagSet("noyoda", flag.ExitOnError)
fs.BoolVar(&includeConst, "include-const", false, "should include const (default is false)")
//nolint:exhaustruct,exhaustivestruct
return &analysis.Analyzer{
Name: "noyoda",
Doc: doc,
Run: run,
Requires: []*analysis.Analyzer{inspect.Analyzer},
Flags: *fs,
Flags: flagset,
}
}

Expand Down

0 comments on commit 9ed226f

Please sign in to comment.