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 recognize ? in .go file #296

Open cyw3 opened 4 years ago

cyw3 commented 4 years ago

when i use lizard 1.17.5 to scan a go file below, and ccn is 10 but it should be 1:

func getQuery(dbIndex uint32, tbIndex uint32) string { 
    query := fmt.Sprintf(`INSERT INTO online_docs_%d.online_docs_notify_%d 
    (a, b, c, d, e, f, g, h, i, j) 
    VALUES (?, ?, ?, ?, ?, ?, ?, FROM_UNIXTIME(?), ?, %d) `, dbIndex, tbIndex, notifyStatusNew) 
    return query 
} 

lizard recognize ? as a ternary operator, and add 1.

cyw3 commented 4 years ago

image

terryyin commented 4 years ago

Noted. thanks. Will try to fix it soon.

On 5 Aug 2020, at 11:30 AM, cyw3 notifications@github.com wrote:

https://user-images.githubusercontent.com/11549103/89368829-08c79400-d70f-11ea-9ac2-7f98c3b6aaf6.png — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/terryyin/lizard/issues/296#issuecomment-668959193, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGASYRHWPC6AO4WCY4RZVLR7DG6XANCNFSM4PKIEGCQ.

503440692 commented 1 year ago

In 1.17.10, the problem still exists. Hope it can be fixed, thanks.