terryyin / lizard

A simple code complexity analyser without caring about the C/C++ header files or Java imports, supports most of the popular languages.
Other
1.82k stars 248 forks source link

Wrong to scan go func with anonymous function #297

Open cyw3 opened 4 years ago

cyw3 commented 4 years ago

The existence of anonymous functions in function testCCN will cause function testCCN to be unrecognized and the cyclomatic complexity will be ignored.

func testCCN() {
    defer func() {
        println("")
    }()
    if true {
        println("")
    }
    if true {
        println("")
    }
}
503440692 commented 1 year ago

In latest version, the problem seem still exists. Hope it can be fixed, thanks.

terryyin commented 1 year ago

What should be the proper behaviour? Count, by as a separate function, or adding to the outer function?