Skip to content

chore: add interrogate to linters called by pre-commit #3465

@terriko

Description

@terriko

We're working our way through improving the docstrings provided in cve-bin-tool's source code, and I think we've got enough files that it would be good to have some pre-commit checks to make sure we continue to improve and don't backslide. I've been pretty happy with interrogate as a tool, so I'd suggest we continue to use that and set it up in pre-commit so it'll run both as part of local checks (for people who use pre-commit) and the github actions checks.

The pre-commit config can be found here:
https://github.com/intel/cve-bin-tool/blob/main/.pre-commit-config.yaml

I'm not sure what the best way to run this will be, but I want it to pass on the current code but fail if a new function or file is added that doesn't have a docstring. We might need to exclude some existing not-yet-updated files in order to make this work; you can take a look at the other configs to see how to use an exclude rule.

I'm using the following flags for interrogate when I run it locally -vv -i -I -M -C -p but I admit I haven't read through all the flags so there may be others we'd like to have enabled, or ones we'd like to use for now as we're in the middle of upgrading the code base.

You'll also want to add interrogate into the dev-requirements list here so people can easily pip install it alongside the other dev tools we use:
https://github.com/intel/cve-bin-tool/blob/main/dev-requirements.txt

This is probably a task suitable to an adventurous beginner but since I'm not sure exactly how complicated the config will need to be I'm not going to flag it as a good first issue right now. Be prepared to do some reading to figure out the best way to use interrogate.

Metadata

Metadata

Assignees

Labels

CIRelated to our continuous integration service (GitHub Actions)hacktoberfestgood issue for hacktoberfest participation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions