Hi there!
Recently I submitted such piece of code to one of my projects:
if 'text' in d.get('a'):
# do something
Obviously that was expected to be something like:
if 'text' in d.get('a', ''):
# do something
because .get() might return None, and checking if something is contained in
None gives you TypeError. Maybe it was too late, I was trying to finish
this piece of code asap and I expected flakes8 to detect this for me, so
when PR became green I merged it. When I realized this piece of code is
buggy it was too late :)
As I don't want to repeat this mistake I decided to take measures. As I was
using flakes8 at the moment and it didn't notice this bug - I thought "Hm,
maybe I should use some better tool, maybe pyflakes is too simple to catch
that". So I tried pylint and prospector. They do almost everything, I
believe both tools can bring you coffee in the bed. But they cannot detect
such a simple error. No success. And that makes me really unhappy. Do you
guys know any Python code analyzer which is able to catch such problem? Is
there a chance this can be implemented in pyflakes? If so - should I create
bug on https://bugs.launchpad.net/pyflakes/+filebug?
--
Best regards,
Alexander Chekunkov
_______________________________________________
code-quality mailing list
[email protected]
https://mail.python.org/mailman/listinfo/code-quality