-
Notifications
You must be signed in to change notification settings - Fork 590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(mobilityd): Fix type errors shown by mypy #11963
Conversation
Thanks for opening a PR! 💯
Howto
More infoPlease take a moment to read through the Magma project's
If this is your first Magma PR, also consider reading
|
Oops! Looks like you failed the Howto
♻️ Updated: ✅ The check is passing the DCO check after the last commit. |
33d9a41
to
d37839f
Compare
I tried static type checking of mobilityd using mypy and fixed some of the errors it found. Mostly these were minor issues (missing return statements or null checks). The only bigger change is the introduction of dedicated types for IP addresses and networks. Signed-off-by: Sebastian Thomas <sebastian.thomas@tngtech.com>
d37839f
to
df4e3e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Thanks for this Sebastian!!! Is there a way to add linters / test coverage for these types of things? |
I'd love to have it in the CI. It would be easy to set up if we could fix all warnings first and then keep it green. Getting to a green state might take a lot of work though. I'm not sure if there is any support for a mode with existing issues, e.g. where it checks that the number of errors doesn't increase so you could lower the allowed error count over time. I'll look into it a bit more... |
I added some more type hints based on the work from magma#11963. Furthermore, I created an MVP for a mypy.ini, which is a first step for adding a type checking step to the CI. Signed-off-by: Nico Carl <nicocarl@protonmail.com>
I added some more type hints based on the work from magma#11963. Furthermore, I created an MVP for a mypy.ini, which is a first step for adding a type checking step to the CI. Signed-off-by: Nico Carl <nicocarl@protonmail.com>
I added some more type hints based on the work from magma#11963. Furthermore, I created an MVP for a mypy.ini, which is a first step for adding a type checking step to the CI. Signed-off-by: Nico Carl <nicocarl@protonmail.com>
I added some more type hints based on the work from magma#11963. Furthermore, I created an MVP for a mypy.ini, which is a first step for adding a type checking step to the CI. Signed-off-by: Nico Carl <nicocarl@protonmail.com>
I added some more type hints based on the work from magma#11963. Furthermore, I created an MVP for a mypy.ini, which is a first step for adding a type checking step to the CI. Signed-off-by: Nico Carl <nicocarl@protonmail.com>
I added some more type hints based on the work from magma#11963. Furthermore, I created an MVP for a mypy.ini, which is a first step for adding a type checking step to the CI. Signed-off-by: Nico Carl <nicocarl@protonmail.com>
I added some more type hints based on the work from magma#11963. Furthermore, I created an MVP for a mypy.ini, which is a first step for adding a type checking step to the CI. Signed-off-by: Nico Carl <nicocarl@protonmail.com>
I added some more type hints based on the work from #11963. Furthermore, I created an MVP for a mypy.ini, which is a first step for adding a type checking step to the CI. Signed-off-by: Nico Carl <nicocarl@protonmail.com>
I added some more type hints based on the work from #11963. Furthermore, I created an MVP for a mypy.ini, which is a first step for adding a type checking step to the CI. Signed-off-by: Nico Carl <nicocarl@protonmail.com>
I tried static type checking of mobilityd using mypy and fixed some of the errors it found. Mostly these were minor issues (missing return statements or null checks). The only bigger change is the introduction of dedicated types for IP addresses and networks. Signed-off-by: Sebastian Thomas <sebastian.thomas@tngtech.com>
I added some more type hints based on the work from magma#11963. Furthermore, I created an MVP for a mypy.ini, which is a first step for adding a type checking step to the CI. Signed-off-by: Nico Carl <nicocarl@protonmail.com>
Summary
I tried static type checking of mobilityd using mypy and fixed some of the errors it found. Mostly these were minor issues (missing return statements or null checks).
The only bigger change is the introduction of dedicated types for IP addresses and networks. Before this PR, they referred to functions as variable types, which is not a valid type hint.
Test Plan
Install mypy in a virtualenv and execute it via
Error count on master:
Error count after the changes:
Additional Information