soweego icon indicating copy to clipboard operation
soweego copied to clipboard

Introduce static type analysis

Open MaxFrax opened this issue 5 years ago • 2 comments

As we all know, a full soweego execution takes weeks. Therefore, it's crucial not to waste any of it. In my experience, happened more than once the execution stopped after days, all due to a change of some function signature.

There are many other easily avoidable issues like that one. I propose to introduce mypy to do some static type checking.

The idea is to set it up in travis and let it decline the PRs in which the number of errors it finds goes up (in comparison with the number of errors in the merge target branch). In this way, PR by PR the code quality and readability will increase.

MaxFrax avatar Mar 03 '20 11:03 MaxFrax

I introduced a shell script in 23afc3ef5399eae5a4c5f25081424731d04e931c that also runs mypy. We can tell travis to execute it and fail the build as appropriate.

Note that mypy only checks functions with type hints declared, and ignores the others, so it's not a complete solution.

marfox avatar Apr 01 '20 09:04 marfox

I introduced a shell script in 23afc3e that also runs mypy. We can tell travis to execute it and fail the build as appropriate.

Note that mypy only checks functions with type hints declared, and ignores the others, so it's not a complete solution.

I think it can be set to complain if the types are not declared. A setting like this one, would encourage us to increase the type declarations coverage.

EDIT: I would like to dig deeper in the matter and get the most we can from this tool.

MaxFrax avatar Apr 02 '20 18:04 MaxFrax