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 jsx #321

Open Yuanruitao opened 3 years ago

Yuanruitao commented 3 years ago

Hello, when I scanned the JSX file, I found that when the JSX function returns the XML content, the line number and function name in the output result will be wrong. sample: chat.js output result(The results in the next few lines are messed up):

/data/chat.js:108: warning: (anonymous) has 19 NLOC, 4 CCN, 82 token, 0 PARAM, 23 length 
/data/chat.js:135: warning: = has 40 NLOC, 5 CCN, 192 token, 0 PARAM, 50 length
/data/chat.js:187: warning: _initEmoji has 15 NLOC, 2 CCN, 57 token, 0 PARAM, 21 length
/data/chat.js:210: warning: = has 15 NLOC, 3 CCN, 76 token, 0 PARAM, 16 length
/data/chat.js:237: warning: = has 8 NLOC, 2 CCN, 53 token, 0 PARAM, 8 length
/data/chat.js:247: warning: = has 7 NLOC, 3 CCN, 46 token, 0 PARAM, 7 length
/data/chat.js:261: warning: (anonymous) has 5 NLOC, 2 CCN, 24 token, 0 PARAM, 5 length
/data/chat.js:256: warning: = has 14 NLOC, 2 CCN, 73 token, 0 PARAM, 19 length
/data/chat.js:303: warning: (anonymous) has 5 NLOC, 2 CCN, 31 token, 0 PARAM, 5 length
/data/chat.js:320: warning: (anonymous) has 29 NLOC, 4 CCN, 83 token, 0 PARAM, 31 length

In some cases, the starting line number does not correspond to the function name