mirror of
https://github.com/mgechev/revive.git
synced 2024-11-24 08:32:22 +02:00
parent
dd6fd357b6
commit
fcccdca4e3
@ -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 {
|
||||
|
3
testdata/cognitive-complexity.go
vendored
3
testdata/cognitive-complexity.go
vendored
@ -278,3 +278,6 @@ func (m *Migrator) MigrateIfNeeded(target *EtcdVersionPair) error { // MATCH /fu
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// no regression test for issue #451
|
||||
func myFunc()
|
||||
|
Loading…
Reference in New Issue
Block a user