srobo / j5

j5 - Framework for Robotics APIs
MIT License
9 stars 4 forks source link

Enforce type hints on all code #68

Closed sedders123 closed 5 years ago

sedders123 commented 5 years ago

Now that the majority of the project has type hints, we should try to keep it that way. We can enforce this by changing our mypy settings to enforce code has type hints.

I propose we enable the following flags, though I'm open to discussion (these are the command line flags but they have equivalent .cfg options):

Docs for the above flags can he found here

trickeydan commented 5 years ago

For reference, current mypy config:

[mypy]
warn_unused_ignores = True
strict_optional = True

disallow_any_generics = True
check_untyped_defs = True

ignore_missing_imports = True

I've had a look at the mypy docs and I think we may want a few more parameters than you suggest in order to strictly enforce typing.

Disallow dynamic typing

Enforcing typing

Docs

Optionals

I agree that optionals should be explicit.

Misc

I'm aware that some of this is outside the scope of this PR, but I decided to look through all of the mypy config options.