forked from forgejo/forgejo
update revive lint to latest commit (#12921)
* update revive lint to latest commit * make fmt * change import
This commit is contained in:
parent
63e8bdaf73
commit
1c3278c2fa
154 changed files with 5965 additions and 8502 deletions
4
vendor/github.com/mgechev/revive/rule/cognitive-complexity.go
generated
vendored
4
vendor/github.com/mgechev/revive/rule/cognitive-complexity.go
generated
vendored
|
@ -52,7 +52,7 @@ type cognitiveComplexityLinter struct {
|
|||
func (w cognitiveComplexityLinter) lint() {
|
||||
f := w.file
|
||||
for _, decl := range f.AST.Decls {
|
||||
if fn, ok := decl.(*ast.FuncDecl); ok {
|
||||
if fn, ok := decl.(*ast.FuncDecl); ok && fn.Body != nil {
|
||||
v := cognitiveComplexityVisitor{}
|
||||
c := v.subTreeComplexity(fn.Body)
|
||||
if c > w.maxComplexity {
|
||||
|
@ -109,7 +109,7 @@ func (v *cognitiveComplexityVisitor) Visit(n ast.Node) ast.Visitor {
|
|||
return nil // skip visiting binexp sub-tree (already visited by binExpComplexity)
|
||||
case *ast.BranchStmt:
|
||||
if n.Label != nil {
|
||||
v.complexity += 1
|
||||
v.complexity++
|
||||
}
|
||||
}
|
||||
// TODO handle (at least) direct recursion
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue