Skip to content

LGTM.com - false positive #3113

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

Open
david-zwicker opened this issue Mar 24, 2020 · 3 comments
Open

LGTM.com - false positive #3113

david-zwicker opened this issue Mar 24, 2020 · 3 comments

Comments

@david-zwicker
Copy link

LGTM complains about Call to a non-callable of class CLS.

In my case, CLS refers to the class and the call should thus create a new instance. I guess the problem in my case is that I needed to add an additional decorator besides the @classmethod to mark the method as a classmethod; see code:

https://lgtm.com/projects/g/zwicker-group/py-pde/snapshot/b591dace7b765362f97b4435a99a1ec95787a504/files/pde/visualization/plotting.py?sort=name&dir=ASC&mode=heatmap#x3c4edeb8f4dc0a46:1

@RasmusWL
Copy link
Member

Thanks for the report! 👍 The problem in your specific case is that from_storage is also decorated with fill_in_docstring, and our analysis is quite conservative when seeing decorators it doesn't know about (since they can do anything).

I've added a boiled-down version of your problem to our tests in #3114, and created an internal tracking ticket for this. But I can't make any promises that fixing this will be a priority

@david-zwicker
Copy link
Author

Yes, I agree that the extra decorator complicates the automatic analysis, but I felt it is a reasonable use-case of decorates. Is there any way to make the algorithm aware of the decorator? After all, this is a trivial one, which only changes the doctoring.

@RasmusWL
Copy link
Member

I agree that we as humans can easily see that this decorator is not causing any problems 😉 and personally I think it's a nice use of decorators.

I don't know of any way that you can make our analysis handle this case right now.

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

No branches or pull requests

2 participants