[BUG] Call to undefined member of django_app.models is not detected
Describe the bug Prospector does not identify calls to undefined members of modules.
To Reproduce I've created a very simple django project from scratch, with a single app. This app has a single model, and a single view.
I have uploaded the entire project to my Github, and linking to a a specific commit for reference here.
As you can see below, I would expect there to be two linting errors.
- One from calling
my_func()with the wrong number of arguments. - The second from calling
models.doesnotexist().
myapp.views.py
from rest_framework import status, views
from rest_framework.response import Response
from . import models
def my_func(a):
print(a)
class MyView(views.APIView):
def get(self, request):
user_id = request.user
print(user_id)
all_models = models.MyModel.objects.all()
print(all_models)
my_func(1, 1)
models.doesnotexist()
return Response(data={"status": "Success!"}, status=status.HTTP_200_OK)
I run prospector as follows, from the folder that contains manage.py:
DJANGO_SETTINGS_MODULE=prospector_test.settings prospector
But I only get these errors, two of them are unrelated:
manage.py
Line: 11
pylint: import-outside-toplevel / Import outside toplevel (django.core.management.execute_from_command_line) (col 8)
myapp/views.py
Line: 17
pylint: too-many-function-args / Too many positional arguments for function call (col 8)
prospector_test/settings.py
Line: 23
dodgy: secret / Possible hardcoded secret key
Check Information
=================
Started: 2021-10-01 17:28:07.578983
Finished: 2021-10-01 15:28:13.116161
Time Taken: -7194.46 seconds
Formatter: grouped
Profiles: default, no_doc_warnings, no_test_warnings, strictness_medium, strictness_high, strictness_veryhigh, no_member_warnings
Strictness: None
Libraries Used: django
Tools Run: dodgy, mccabe, pep8, profile-validator, pyflakes, pylint
Messages Found: 3
As we can see, the error on Line 17 has been identified, but the error on Line 18 (models.doesnotexist()) has not.
Expected behavior I would expect there to be a Message about the call to:
models.doesnotexist()
Environment (please complete the following information):
- OS: [Linux]
- Tool [pylint-django]
- Prospector version [e.g. 1.5.1]
- Python version [e.g. 3.9.7]