Type annotation "coverage"?

Hello people. We probably mostly know that coverage tools are great for measuring test quality. Code coverage isn't perfectly correlated with good tests, but it's a decent measure anyway. Is there a tool sort of analogous to coverage.py, but for automatically checking the percentage of functions and methods (and containers?) with type annotations in a large code base? I'm aware of tools like Monkeytype, but I don't think they're going to get us to 100% annotated in a day - because we have multiple projects, because we have nested functions and methods that some tools don't appreciate, and because there will almost certainly be functions and methods that aren't exercised during a given Monkeytype run. Thanks!

Hey,
Yep, mypy :) https://mypy.readthedocs.io/en/stable/command_line.html#report-generation The cobertura XML report seems to be standard-compliant so you can e.g. use it with diff-cover to see how type annotation coverage changes with a commit: https://pypi.org/project/diff-cover/ Florian

Hey,
Yep, mypy :) https://mypy.readthedocs.io/en/stable/command_line.html#report-generation The cobertura XML report seems to be standard-compliant so you can e.g. use it with diff-cover to see how type annotation coverage changes with a commit: https://pypi.org/project/diff-cover/ Florian
participants (2)
-
Dan Stromberg
-
Florian Bruhin