Hi all, I wrote a small static analyser which can catch stuff like:
def foo(a, b): return a*b
foo(123) ## error: wrong number of arguments
class Foo():
def __init__(self, a):
self.a = a
def bar(self, c):
print(self.a) ## OK
return self.c ## error, because self.c never assigned
Foo() ## error: wrong number of arguments in init
You can find it here:
https://github.com/JohannesBuchner/pystrict3
and install as usual:
pip3 install pystrict3
pystrict3.py myfile.py
It further asserts a strict subset of Python, where you are not allowed
to mangle the internals nor re-assign variables.
Perhaps some can find it useful for writing more obvious code.
It can be used additional to pyflakes, pylint, flake8, etc.
Let me know any feedback, bugs, etc., and whether you think it is a
stupid or interesting idea.
Cheers,
Johannes
signature.asc
Description: OpenPGP digital signature
_______________________________________________ code-quality mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/code-quality.python.org/ Member address: [email protected]
