From b24cbaeec841bff474c142d06a408b5cfa9503bc Mon Sep 17 00:00:00 2001 From: alingse Date: Mon, 11 Jul 2022 20:59:53 +0800 Subject: [PATCH] rename default to builtin --- asasalint.go | 8 ++++---- asasalint_test.go | 2 +- cmd/asasalint/main.go | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/asasalint.go b/asasalint.go index d7e7aef..edff914 100644 --- a/asasalint.go +++ b/asasalint.go @@ -12,11 +12,11 @@ import ( "golang.org/x/tools/go/ast/inspector" ) -const DefaultExclude = `Printf,Println,Errorf,Fprintf,Fprintln,Fatal,Fatalf,Panic,Panicf,Panicln,Print,Printf,Println,Sprintf,Sprintln,Error,Errorf,Info,Infof,Warn,Warnf,Debug,Debugf` +const BuiltinExclude = `Printf,Println,Fprintf,Fprintln,Fatal,Fatalf,Panic,Panicf,Panicln,Print,Printf,Println,Sprintf,Sprintln,Error,Errorf,Info,Infof,Warn,Warnf,Debug,Debugf` type LinterSetting struct { Exclude []string - NoDefaultExclude bool + NoBuiltinExclude bool IgnoreInTest bool } @@ -41,8 +41,8 @@ func newAnalyzer(setting LinterSetting) *analyzer { setting: setting, } - if !a.setting.NoDefaultExclude { - for _, exclude := range strings.Split(DefaultExclude, `,`) { + if !a.setting.NoBuiltinExclude { + for _, exclude := range strings.Split(BuiltinExclude, `,`) { a.excludes[exclude] = true } } diff --git a/asasalint_test.go b/asasalint_test.go index 5b33e50..94bc99b 100644 --- a/asasalint_test.go +++ b/asasalint_test.go @@ -85,7 +85,7 @@ func TestNewAnalyzer(t *testing.T) { _ = NewAnalyzer(LinterSetting{}) _ = NewAnalyzer(LinterSetting{ Exclude: []string{"hello"}, - NoDefaultExclude: true, + NoBuiltinExclude: true, IgnoreInTest: true, }) } diff --git a/cmd/asasalint/main.go b/cmd/asasalint/main.go index cf0c864..3d6da45 100644 --- a/cmd/asasalint/main.go +++ b/cmd/asasalint/main.go @@ -10,22 +10,22 @@ import ( func main() { var extraExclude string - var noDefaultExclude bool + var noBuiltinExclude bool var ignoreInTest bool flag.StringVar(&extraExclude, "e", "", - "Extra Exclude Func Names, like: FuncA,append,Append", + "extra exclude func names, like: FuncA,append,Append", ) - flag.BoolVar(&noDefaultExclude, "no-default-exclude", false, - "disbale the default exclude func names: "+asasalint.DefaultExclude) + flag.BoolVar(&noBuiltinExclude, "no-builtin-exclude", false, + "disbale the builtin exclude func names: "+asasalint.BuiltinExclude) flag.BoolVar(&ignoreInTest, "ignore-in-test", false, "ingore case in *_test.go") flag.Parse() setting := asasalint.LinterSetting{ Exclude: strings.Split(extraExclude, ","), - NoDefaultExclude: noDefaultExclude, + NoBuiltinExclude: noBuiltinExclude, IgnoreInTest: ignoreInTest, } singlechecker.Main(asasalint.NewAnalyzer(setting))