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 247 forks source link

Anonymous function and Nested functions #208

Open cyw3 opened 6 years ago

cyw3 commented 6 years ago

Does Lizard support Anonymous function and Nested functions?

I want to know the situation of Anonymous function and Nested functions in each language lizard supported.

Thanks!

Test: python: def outer(n): def inner_multiple(n): return n * 2 num = inner_multiple(n) print(num)

js: var Prison=function() {
var food='rice'; return Prisoner(){ return food; }; }

cyw3 commented 6 years ago

image and use lizard to scan the code, lizard can not find this kind of Anonymous function : image

cyw3 commented 6 years ago

image Lizard just find function Prison() and can not find Prisoner(). image

cyw3 commented 6 years ago

image We can see these two function_name is the same but start_line and end_line. I think it is not suitable.

3,1,11,0,3,"function@3-5@/Users//Desktop/Test/lizard/test.js","/Users//Desktop/Test/lizard/test.js","function","function )",3,5 1,1,9,0,1,"function@10-10@/Users//Desktop/Test/lizard/test.js","/Users//Desktop/Test/lizard/test.js","function","function )",10,10,

cyw3 commented 6 years ago

python code: f = lambda x: x * x

lizard can not find this kind of fun. i think lizard can calculate this fun's CCN.

cyw3 commented 6 years ago

image

image

terryyin commented 6 years ago

Thanks! I will use your example to test drive the fix.

cyw3 commented 6 years ago

image

image

why does lizard not support python namespace? you can add the class name to long name of lizard functionInfo.

also in js code.

@terryyin