Skip to content
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

docs: Add docstrings to vex_manager/generate.py #4541

Open
terriko opened this issue Oct 29, 2024 · 5 comments
Open

docs: Add docstrings to vex_manager/generate.py #4541

terriko opened this issue Oct 29, 2024 · 5 comments
Assignees
Labels
documentation Documentation changes good first issue Good for newcomers hacktoberfest good issue for hacktoberfest participation

Comments

@terriko
Copy link
Contributor

terriko commented Oct 29, 2024

We haven't been entirely consistent about adding python docstrings to every function, and I figured I'd file some easy to fix issues for hacktoberfest participants who are maybe working on getting their commits in this week.

What is a docstring?

Here's a tutorial on
docstrings
in case
you're not sure what they are. Basically I want someone to write a short
sentence explaining what a function does and have it put at the top of the
function in the way that python expects docstrings to look. (You can also do
classes and methods.) Among other things, docstrings can be used by integrated
development environments (IDEs) to give contributors a quick overview of the
function without having to read the code.

This issue

This issue is for updating the file listed in the title of the issue: vex_manager/generate.py

We are using interrogate (a tool for checking docstrings) as follows:
interrogate -vv -i -I -M -C -n -p vex_manager/generate.py

$ interrogate -vv -i -I -M -C -n -p -f 60.0 vex_manager/generate.py
================ Coverage for /home/terri/Code/cve-bin-tool/cve_bin_tool/vex_manager/ ================
----------------------------------------- Detailed Coverage ------------------------------------------
| Name                                                          |                             Status |
|---------------------------------------------------------------|------------------------------------|
| generate.py                                                   |                                    |
|   VEXGenerate (L14)                                           |                             MISSED |
|     VEXGenerate.generate_vex (L68)                            |                            COVERED |
|---------------------------------------------------------------|------------------------------------|

---------------------------------------------- Summary -----------------------------------------------
| Name                   |            Total |            Miss |            Cover |            Cover% |
|------------------------|------------------|-----------------|------------------|-------------------|
| generate.py            |                2 |               1 |                1 |               50% |
|------------------------|------------------|-----------------|------------------|-------------------|
| TOTAL                  |                2 |               1 |                1 |             50.0% |
--------------------------- RESULT: FAILED (minimum: 60.0%, actual: 50.0%) ---------------------------

You can run that locally to see if you're done, but we also recommend using
pre-commit to run pre-checks for you before submitting a pull request.
Instructions here:

https://cve-bin-tool.readthedocs.io/en/latest/CONTRIBUTING.html#using-pre-commit-to-run-linters-automatically

Or in short, go to the main cve-bin-tool directory and run the following:

pip install pre-commit
pre-commit install --hook-type pre-commit --hook-type commit-msg

Short tips for new contributors:

  • cve-bin-tool's contributor docs
  • If you've contributed to open source but not this project, you might just want our checklist for a great pull request
  • cve-bin-tool uses https://www.conventionalcommits.org/ style for commit messages, and we have a test that checks the title of your pull request (PR). A good potential title for this one is in the title of this issue.
  • You can make an issue auto close by including a comment "fixes #ISSUENUMBER" in your PR comments where ISSUENUMBER is the actual number of the issue. This "links" the issue to the pull request.

Claiming issues:

  • You do not need to have an issue assigned to you before you work on it. To "claim" an issue either make a linked pull request or comment on the issue saying you'll be working on it.
  • If someone else has already commented or opened a pull request, assume it is claimed and find another issue to work on.
  • If it's been more than 1 week without progress, you can ask in a comment if the claimant is still working on it before claiming it yourself (give them at least 3 days to respond before assuming they have moved on).
@terriko terriko added good first issue Good for newcomers documentation Documentation changes hacktoberfest good issue for hacktoberfest participation labels Oct 29, 2024
@vroomvee
Copy link
Contributor

Working on this issue for hacktoberfest!

@terriko
Copy link
Contributor Author

terriko commented Oct 30, 2024

@vroomvee thanks! Let us know if you need any help!

@vroomvee
Copy link
Contributor

isort....................................................................Passed
black....................................................................Failed

  • hook id: black
  • files were modified by this hook

reformatted cve_bin_tool/vex_manager/generate.py

All done! ✨ 🍰 ✨
1 file reformatted.

I am getting this as an output after committing the docstrings but i am unable to create a PR, can you help me?

@vroomvee
Copy link
Contributor

isort....................................................................Passed black....................................................................Failed

  • hook id: black
  • files were modified by this hook

reformatted cve_bin_tool/vex_manager/generate.py

All done! ✨ 🍰 ✨ 1 file reformatted.

I am getting this as an output after committing the docstrings but i am unable to create a PR, can you help me?

Name Total Miss Cover Cover%
generate.py 2 0 2 100%
---------------------- ------------- ------------ ------------- --------------
TOTAL 2 0 2 100.0%
--------------- RESULT: PASSED (minimum: 60.0%, actual: 100.0%) ----------------

@terriko
Copy link
Contributor Author

terriko commented Oct 30, 2024

If black reformatted the file, you'll need to re-add it to get the changes in:
git add cve_bin_tool/vex_manager/generate.py

and then
git commit
should pass all checks and let you make a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation changes good first issue Good for newcomers hacktoberfest good issue for hacktoberfest participation
Projects
None yet
Development

No branches or pull requests

2 participants