cve-bin-tool
cve-bin-tool copied to clipboard
Add type hints
Now that we've dropped support for older versions of Python, we have the option to use type hints as described in PEP-0484. We don't need this and it's not urgent, but it might be a nice improvement to code readability so I'm going to put it out there as an idea for discussion or use on new code.
Hello @terriko , Abhishek here! I'm a complete beginner to Open Source and would like to contribute to this project. Kindly guide me. Thanks!
Copying this question/answer from #1073 because I think others may have the same question:
should we write type hints for all variables ? (or to only those which would improve readability)
I'd like to have type hints for all variables for consistency and so eventually we could put in a CI rule that reminds contributors if the type hints are missing. Readability tends to be in the eye of the beholder and thus not so easy to script.
That said, it's possible we'll want to make some custom types to improve readability and be more explicit about what's expected in our structures. (for example of how this might be useful, see the question in #1026) .
I suppose we want to add the check for types to CI eventually? Any ideas on what tool to use? MyPy, Pyright?
For which file we need to add type hints?
I've pulled this out into individual per-file issues, so I'm going to close this in favour of the individual ones.