Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong CCN of Python file #56

Closed
ghost opened this issue Mar 24, 2015 · 3 comments
Closed

Wrong CCN of Python file #56

ghost opened this issue Mar 24, 2015 · 3 comments

Comments

@ghost
Copy link

ghost commented Mar 24, 2015

Hi!

I stumbled upon a Python file at work for which lizard calculates a wrong CCN.

# code somewhat simplified
def method1(self):
    pass

class Class1(object):
    def method2(self):

        if True:
            pass
        if True:
            pass

        def method1(param):
            for x in (1,2):
                pass

        if True:
            pass

        if True:
            pass

        while True:
            if True:
                pass

            for x in (1,2):
                True

    def method3(self):
        if True:
            for x in (1,2):
                if True:
                    pass
                else:
                    pass
        if True:
            pass
        else:
            pass

    def method4(self):
        if True:
            pass

        if True:
            pass

        if True:
            if True
                pass

        if True:
            if True:
                pass

        if True:
            pass
        else:
            pass

def memoize(obj):
    obj.cache = {}

Lizard tells me that method1() ranges from line 1 to line 62 and has a CCN of 20. If I remove the last two lines (memoize()), it works as expected.

Bye, Robert

Btw: lizard is a great tool and I use it every day.

@terryyin
Copy link
Owner

@rschulze /Robert, thanks for the report. I will look at it within days.

@terryyin
Copy link
Owner

Hi @rschulze this code might be simplified a bit too much and missed the key part. I cannot reproduce the problem. Could you please supply more?

@ghost
Copy link
Author

ghost commented Apr 9, 2015

Hi @terryyin : The problem seemes to be solved after upgrading :-) Thanks for your help!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant