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.81k stars 246 forks source link

Fix incorrect python function end line when function declared with multiple lines #346

Closed lijingda closed 2 years ago

lijingda commented 2 years ago

fix issue #292

In a multi-line function declaration, if a subsequent line is indented much more than the first line, it will result in the wrong end line of the function.

Example:

def foo(arg1,
        arg2,
        arg3
):
    if True:
        return
# old: 4 now: 6
terryyin commented 2 years ago

Hi @lijingda thanks for the contribution. Would it be better if we create a new test case for this situation instead of changing the existing test?

And since there is a OR in the new if, perhaps at least another test case is needed?