-
Notifications
You must be signed in to change notification settings - Fork 470
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
fix: KeyError in format_data function #3452
Conversation
Debugged the code based on a basic problem that I faced while installing cve-bin-tool
Codecov Report
@@ Coverage Diff @@
## main #3452 +/- ##
==========================================
- Coverage 78.56% 78.05% -0.51%
==========================================
Files 758 758
Lines 11484 11487 +3
Branches 1342 1343 +1
==========================================
- Hits 9022 8966 -56
- Misses 2038 2096 +58
- Partials 424 425 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 5 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Thanks for working on this!
I've got a couple of nitpicks for the linters; I've marked them as suggestions but I'm going to merge them now and let the linters run again.
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.
I can't merge this while it's still failing black and flake8 checks, but this is close enough to ready that i'm going to mark it as approved for hacktoberfest in case you need the credit. Please fix the linter issues when you get a chance, or if they're too much let me know and I'll try to resolve them for you later in the week.
This comment was marked as resolved.
This comment was marked as resolved.
Updates
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.
I'm going to see if I can fix the issues reported manually since they look pretty simple to do:
cve_bin_tool/data_sources/osv_source.py:302:30: E261 at least two spaces before inline comment
cve_bin_tool/data_sources/osv_source.py:303:18: W291 trailing whitespace
I'll merge these and let the tests re-run.
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.
black issues have been resolved manually by me, so this is ready to merge. Thank you and happy hacktoberfest!
* Update osv_source.py Debugged the code based on a basic problem that I faced while installing cve-bin-tool * fix: flake8 and codeql tweaks * chore: blacken cve_bin_tool/data_sources/osv_source.py --------- Co-authored-by: Terri Oda <terri.oda@intel.com>
This pull request addresses a KeyError issue in the
format_data
function. The function was encountering a KeyError when attempting to access thepackage
key in certain cases. To resolve this issue, a check has been added to ensure that thepackage
key exists before attempting to access its contents. This modification ensures that the function can handle cases where thepackage
key is missing or empty, preventing the KeyError.Additionally, this change includes minor formatting improvements for better readability and consistency.
This fix has been thoroughly tested and ensures the reliable execution of the
format_data
function, enhancing its robustness.Please review and merge at your earliest convenience. Thank you!