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

⚠️ Make all ScorecardResult format options pointers #4151

Merged
merged 3 commits into from
Jun 10, 2024

Conversation

spencerschrock
Copy link
Contributor

What kind of change does this PR introduce?

breaking change

What is the current behavior?

Some of the AsX functions take pointers (AsProbe), some take structs (AsString, AsJSON2)

What is the new behavior (if this is a feature change)?**

All three AsX functions which have option structs, take pointers.

  • Tests for the changes have been added (for bug fixes/features)

Which issue(s) this PR fixes

One item from #4048

Special notes for your reviewer

Does this PR introduce a user-facing change?

For user-facing changes, please add a concise, human-readable release note to
the release-note

(In particular, describe what changes users might need to make in their
application as a result of this pull request.)

NONE

Callers can pass in a nil pointer to use the default values.
This is also consistent with AsProbe which already used a pointer.

Signed-off-by: Spencer Schrock <sschrock@google.com>
Signed-off-by: Spencer Schrock <sschrock@google.com>
@spencerschrock spencerschrock requested a review from a team as a code owner June 6, 2024 20:27
@spencerschrock spencerschrock requested review from naveensrinivasan and justaugustus and removed request for a team June 6, 2024 20:27
Copy link
Contributor

@raghavkaul raghavkaul left a comment

Choose a reason for hiding this comment

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

Just curious, what's the motivation to make all of the functions return pointers instead of all return values?

@spencerschrock
Copy link
Contributor Author

Just curious, what's the motivation to make all of the functions return pointers instead of all return values?

From my own experience, being able to pass nil is slightly shorter when I just want to use the defaults. But I took a look at what some of our other libraries do, and they both use pointers for options too, so I figured that was better.

For example the go-gitlab often uses pointers: https://pkg.go.dev/github.com/xanzy/go-gitlab#ProjectsService.GetProject
As does our go-github library: https://pkg.go.dev/github.com/google/go-github/github#ChecksService.ListCheckRunsForRef

Copy link

codecov bot commented Jun 10, 2024

Codecov Report

Attention: Patch coverage is 48.14815% with 14 lines in your changes missing coverage. Please review.

Project coverage is 60.37%. Comparing base (02f72e0) to head (e3d71e0).
Report is 17 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4151      +/-   ##
==========================================
- Coverage   66.11%   60.37%   -5.75%     
==========================================
  Files         232      212      -20     
  Lines       16567    15468    -1099     
==========================================
- Hits        10954     9339    -1615     
- Misses       4925     5433     +508     
- Partials      688      696       +8     

@spencerschrock spencerschrock merged commit 20ec42c into ossf:main Jun 10, 2024
37 of 38 checks passed
@spencerschrock spencerschrock deleted the fix-format-options branch June 10, 2024 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants