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

cyclomatic complexity (&&) bug in clike #98

Closed mehrdad89 closed 8 years ago

mehrdad89 commented 8 years ago

HI!

I am currently writing tests to find bugs in nesting depth metric which I soon commit to this project however as of now (lizard 1.10.4) there is a problem with cyclomatic complexity counting down (&&) in this unit test.

def test_one_function_with_statement_no_curly_brackets(self):
    result = get_cpp_function_list("""
    x c() {
    if (a > -1 && b>= 0 )
          if(a != 0)
                a = b;
    }
    """)
    self.assertEqual(4, result[0].cyclomatic_complexity)

I think it has a direct contradiction with the (test_one_function_with_r_value_ref_in_body) unit test .

terryyin commented 8 years ago

Hi @mehrdad89 sorry I overlook your message (the preview of the email has only "Hi!") I'm looking at it...

terryyin commented 8 years ago

@mehrdad89 you are right, the bug is introduced when I made the solution for r_value_ref. It's now fixed with https://github.com/terryyin/lizard/commit/2a165bdd1cb1b318a15bf6b1bfdce8bcc32d70df I will create a new release next week.

thanks for the reporting.

mehrdad89 commented 8 years ago

thank for the reply! Actually I just finished coding a new metric (nesting depth metric) into lizard. At the moment, it is only supporting clike and python. Hopefully if all test are done I will be pushing it to your repository today.

terryyin commented 8 years ago

Great! Cannot wait (but it’s bed time here).

BTW, adding tests after the implementation sounds really boring:P

On 28 Feb 2016, at 11:22 PM, Mehrdad Mehraban notifications@github.com wrote:

thank for the reply! Actually I just finished coding a new metric (nesting depth metric) into lizard. At the moment, it is only supporting clike and python. Hopefully if all test are done I will be pushing it to your repository today.

— Reply to this email directly or view it on GitHub https://github.com/terryyin/lizard/issues/98#issuecomment-189891423.

mehrdad89 commented 8 years ago

Yeap! tell me about it!