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.85k stars 250 forks source link

Option to Exclude Switch/Case Cascades #201

Closed hgn closed 6 years ago

hgn commented 6 years ago

One major cited disadvantage with Cyclomatic Complexity are switch/case statements. Using lizard in larger projects the upper 10% are valid switch case statements where you never want to replace this code. Even more: nearly no switch case statement in the analysed code can or will be replaced - they are all fine.

Idea: add an option to exclude switch/case statements from the analysis. Will be helpful for a lot of projects!

terryyin commented 6 years ago

I think there is an option already, which is —modified. I think the help message can be improved.

On 21 Nov 2017, at 4:07 AM, Hagen Paul Pfeifer notifications@github.com wrote:

One major cited disadvantage with Cyclomatic Complexity are switch/case statements. Using lizard in larger projects the upper 10% are valid switch case statements where you never want to replace this code. Even more: nearly no switch case statement in the analysed code can or will be replaced - they are all fine.

Idea: add an option to exclude switch/case statements from the analysis. Will be helpful for a lot of projects!

— 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/201, or mute the thread https://github.com/notifications/unsubscribe-auth/AAwJYg_ll4DDOvahhijrX4LDjSc7BCd2ks5s4dvsgaJpZM4Qk0qB.

hgn commented 6 years ago

Great news! Yes the help message should be extended to understand this aspect. Are there any other side aspects or is it just "remove switch/case" from the statistics?

terryyin commented 6 years ago

The only change is counting "switch" instead of counting "case". Yeah, the option "--modified" is a bit over generalisation for something very specific:-)

Will add it to the help and readme.

hgn commented 6 years ago

Perfect! Thank you @terryyin