cve-bin-tool icon indicating copy to clipboard operation
cve-bin-tool copied to clipboard

Add type hints

Open terriko opened this issue 4 years ago • 3 comments

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.

terriko avatar Jun 25 '20 22:06 terriko

Hello @terriko , Abhishek here! I'm a complete beginner to Open Source and would like to contribute to this project. Kindly guide me. Thanks!

asnature avatar Nov 12 '20 11:11 asnature

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) .

terriko avatar Feb 18 '21 16:02 terriko

I suppose we want to add the check for types to CI eventually? Any ideas on what tool to use? MyPy, Pyright?

Molkree avatar Oct 22 '21 17:10 Molkree

For which file we need to add type hints?

kishan3 avatar Oct 07 '22 12:10 kishan3

I've pulled this out into individual per-file issues, so I'm going to close this in favour of the individual ones.

terriko avatar Oct 25 '22 20:10 terriko