Hello,

I would like to know how to detect (e.g. via a linter) typos in function names imported from another module.

Let's assume this given Python code snippet.

import foo
foo.baR()

The package "foo" do contain a function named "bar()" (all lower case letters). The function "baR()" does not exist in "foo". This cause an AttributeError when run with a Python interpreter.

The described error is not detected in my IDE (Emacs with eglot, pylsp and flake8) and not by flake8 on the shell. Because the involved tools do not look inside the "foo" package if "baR()" really exist.

Can I fix this somehow?

I am aware that this would get detected by a unit test. That is the way I do prefer in most cases. But sometimes not all code segments are covered by tests. I'm more interested in using a linter or something else for that.

Kind
Christian
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to