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

refactor: Licence matcher #1491

Merged
merged 2 commits into from
Jan 15, 2025
Merged

Conversation

another-rex
Copy link
Collaborator

@another-rex another-rex commented Jan 13, 2025

Also partially removes the global user agent variable to be specificly passed in for every client.

Majority of the code in licencematcher.go is migrated from the deleted license.go file.

@codecov-commenter
Copy link

codecov-commenter commented Jan 13, 2025

Codecov Report

Attention: Patch coverage is 69.87952% with 25 lines in your changes missing coverage. Please review.

Project coverage is 66.95%. Comparing base (7acec29) to head (18c31f2).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...lients/clientimpl/licensematcher/licensematcher.go 66.66% 16 Missing and 5 partials ⚠️
pkg/osvscanner/osvscanner.go 66.66% 2 Missing and 1 partial ⚠️
scripts/generate_mock_resolution_universe/main.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1491      +/-   ##
==========================================
+ Coverage   66.84%   66.95%   +0.10%     
==========================================
  Files         198      198              
  Lines       18650    18652       +2     
==========================================
+ Hits        12467    12488      +21     
+ Misses       5498     5483      -15     
+ Partials      685      681       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

// DepsDevLicenseMatcher implements the LicenseMatcher interface with a deps.dev client.
// It sends out requests for every package version and does not perform caching.
type DepsDevLicenseMatcher struct {
Client *datasource.DepsDevAPIClient
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think clients in internal/resolution/datasource meant to be used for dependency resolution. considering we are going to use DepsDevAPICleint for license matching as well, shall we move resolution/datasource to datasource?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah probably a good idea, I'll create an issue for it to keep track, we can do it in a followup PR.

@another-rex another-rex merged commit 2e9d96a into google:main Jan 15, 2025
15 checks passed
another-rex added a commit that referenced this pull request Jan 15, 2025
I am attempting to split a big refactor PR into several small pieces,
this is part 4, which just removes the need for the osv package from
many places since we are replacing it with the osvdev package. This
mostly means user agent need to be passed in via the client instead of
being pulled from a global variable (this was already started in part 3:
#1491 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants