На 19.04.2018 в 01:08, Skip Montanaro написа:
Thanks, good to know. Yet another tool for the kit...

S

On Wed, Apr 18, 2018, 3:43 PM Dan Stromberg <strom...@gmail.com <mailto:strom...@gmail.com>> wrote:


    IINM, mypy can catch such things.  But that's a different sort of tool of
    course.

    On Wed, Apr 18, 2018 at 1:25 PM, Skip Montanaro <skip.montan...@gmail.com
    <mailto:skip.montan...@gmail.com>> wrote:

        Is there a static checker which will catch multiple return types?
        Consider this dumb example:

        def func(a, b, c):
             if c:
                 return (a, b)
             return 0

        I thought pylint had a checker for that, but running with
        --rcfile=/dev/null didn't complain about the different types being
        returned. Is there perhaps a checker for that which isn't enabled by
        default? Or another static tool which will catch it?


Sounds like _check_consistent_returns in checkers/refactoring.py needs to be updated to inspect the type of the value being returned. Please open a GitHub issue for that. At the top of my head I have no idea how hard or easy this is to implement.

--
Alex


_______________________________________________
code-quality mailing list
code-quality@python.org
https://mail.python.org/mailman/listinfo/code-quality

Reply via email to