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

Detection of Deeply Nested Control Structures #69

Closed rakhimov closed 8 years ago

rakhimov commented 9 years ago

This metric may not apply to the whole function, but the maximum 'nestedness' (nesting for-loops, if-statements, etc.) may be an interesting metric to detect code smell.

It closely relates to indentation. Got this from the Linux kernel coding style:

The answer to that is that if you need more than 3 levels of indentation, you're screwed anyway, and should fix your program.

mehrdad89 commented 8 years ago

Hi @terryyin! I think this metric will be a great addition to this awesome tool. I'm gonna do it! Hopefully, I can finish it this weekend.