1
0
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:
sina safari 2021-09-26 09:58:58 +03:30 committed by GitHub
parent 527bea8bea
commit 0bcc996acf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 7 deletions

View File

@ -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"

View File

@ -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)

View File

@ -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
}

View File

@ -63,7 +63,6 @@ func (w *lintMaxPublicStructs) Visit(n ast.Node) ast.Visitor {
if strings.ToUpper(first) == first {
w.current++
}
break
}
return w
}