Re: Detect naming typos (AttributeError) in function names
On 11/7/2023 2:48 AM, Christian Buhtz via Python-list wrote: Hello Dieter, thanks for your reply. Am 06.11.2023 19:11 schrieb Dieter Maurer: One option is a test suite (--> Python's "unittest" package) with a sufficiently high coverage (near 100 %). Yes, that is the primary goal. But it is far away in the related project. I got a hint that "pylint" is able to detect problems like this. mypy can detect typos in names by noticing that they haven't been declared. For example, if you have a class NewClass(BaseClass), and BaseClass has a method findme(), but you call it as findMe(), mypy will tell you findMe does not exist in BaseClass. It can be annoying to get the options set right so you don't get too many undesired hits, but it's certainly doable. mypy can be slow, depending on your code. You could also simply run py_compile, which will try to compile the code. It will stop at the first error it finds. -- https://mail.python.org/mailman/listinfo/python-list
Re: Detect naming typos (AttributeError) in function names
Hello Dieter, thanks for your reply. Am 06.11.2023 19:11 schrieb Dieter Maurer: One option is a test suite (--> Python's "unittest" package) with a sufficiently high coverage (near 100 %). Yes, that is the primary goal. But it is far away in the related project. I got a hint that "pylint" is able to detect problems like this. -- https://mail.python.org/mailman/listinfo/python-list
Re: Detect naming typos (AttributeError) in function names
Dieter Maurer via Python-list ezt írta (időpont: 2023. nov. 6., H, 19:13): > c.bu...@posteo.jp wrote at 2023-11-6 12:47 +: > >I would like to know how to detect (e.g. via a linter) typos in function > >names imported from another module. > > One option is a test suite (--> Python's "unittest" package) > with a sufficiently high coverage (near 100 %). > -- > https://mail.python.org/mailman/listinfo/python-list > Hi PyCharm IDE warns you, also vulture https://pypi.org/project/vulture/ finds dead code (not called / not used because of typo), and if you compile the code: https://docs.python.org/3/library/py_compile.html it will generate syntax error if non-existent function is called. linters can perhaps warn you (never had typos, because I use PyCharm) need to check the linters' doc BR, George -- https://mail.python.org/mailman/listinfo/python-list
Re: Detect naming typos (AttributeError) in function names
c.bu...@posteo.jp wrote at 2023-11-6 12:47 +: >I would like to know how to detect (e.g. via a linter) typos in function >names imported from another module. One option is a test suite (--> Python's "unittest" package) with a sufficiently high coverage (near 100 %). -- https://mail.python.org/mailman/listinfo/python-list