1
0
Fork 0
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:
techknowlogick 2020-09-22 13:02:16 -04:00 committed by GitHub
parent 63e8bdaf73
commit 1c3278c2fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
154 changed files with 5965 additions and 8502 deletions

View file

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