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

Fixing bug when python has multiple line for function declaration due to formatting #319

Closed alyssawangqq closed 3 years ago

alyssawangqq commented 3 years ago

Currently there's bug in python Lizard when getting LOC and CCN when func declaration has multiple lines. It will only count the function declaration lines but not the implementation. This is because the original code uses indentation to check function ending while for multi-line declaration, the last line will start with ")" with no indent.

Example:

def f1(a,
    b
):
  # function implementation for 10 lines

Issue in https://github.com/terryyin/lizard/issues/292

terryyin commented 3 years ago

Hi @alyssawangqq thanks for the pull request. Could you please add a test for the scenario?

terryyin commented 3 years ago

But the new test is not passing?

alyssawangqq commented 3 years ago

@terryyin Sorry just fixed error in test

terryyin commented 3 years ago

Thank you very much!