mirror of
https://github.com/mgechev/revive.git
synced 2025-02-11 13:38:40 +02:00
fixed some complex code (#580)
This commit is contained in:
parent
527bea8bea
commit
0bcc996acf
@ -91,10 +91,7 @@ func (f *File) IsUntypedConst(expr ast.Expr) (defType string, ok bool) {
|
||||
}
|
||||
|
||||
func (f *File) isMain() bool {
|
||||
if f.AST.Name.Name == "main" {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return f.AST.Name.Name == "main"
|
||||
}
|
||||
|
||||
const directiveSpecifyDisableReason = "specify-disable-reason"
|
||||
|
@ -82,7 +82,7 @@ func (r *AddConstantRule) Apply(file *lint.File, arguments lint.Arguments) []lin
|
||||
failures = append(failures, failure)
|
||||
}
|
||||
|
||||
w := lintAddConstantRule{onFailure: onFailure, strLits: make(map[string]int, 0), strLitLimit: strLitLimit, whiteLst: whiteList}
|
||||
w := lintAddConstantRule{onFailure: onFailure, strLits: make(map[string]int), strLitLimit: strLitLimit, whiteLst: whiteList}
|
||||
|
||||
ast.Walk(w, file.AST)
|
||||
|
||||
|
@ -17,7 +17,7 @@ func (r *EmptyBlockRule) Apply(file *lint.File, _ lint.Arguments) []lint.Failure
|
||||
failures = append(failures, failure)
|
||||
}
|
||||
|
||||
w := lintEmptyBlock{make(map[*ast.BlockStmt]bool, 0), onFailure}
|
||||
w := lintEmptyBlock{make(map[*ast.BlockStmt]bool), onFailure}
|
||||
ast.Walk(w, file.AST)
|
||||
return failures
|
||||
}
|
||||
|
@ -63,7 +63,6 @@ func (w *lintMaxPublicStructs) Visit(n ast.Node) ast.Visitor {
|
||||
if strings.ToUpper(first) == first {
|
||||
w.current++
|
||||
}
|
||||
break
|
||||
}
|
||||
return w
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user