Closed rakhimov closed 4 years ago
@rakhimov I have reverse-engineered the nested structure implementation with https://github.com/terryyin/lizard/compare/e4f7ff1889ee...63ceb48a3ea7.
Thanks for your great tests. I had a wonderful journey of test-driven development. Didn't re-implement it for Python though. I think for Python it's just the level of indentations.
Python reutilizes keywords for list comprehension (
for
,if
) and ternary operator (if
,else
). the current implementation of the nesting structure count, which depends on the nesting level of tokens, does not differentiate between expressions or statements for these keywords and keeps counting the nesting level.Examples:
These examples will produce NS = 2 and 1, respectively, instead of 0.