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

🐛 Code Review: Use proportional scoring #2882

Merged
merged 15 commits into from
Jun 14, 2023

Conversation

raghavkaul
Copy link
Contributor

@raghavkaul raghavkaul commented Apr 17, 2023

What kind of change does this PR introduce?

Revert Code-Review check to proportional scoring.

What is the current behavior?

Currently, Code-Review works like this:
If the only commit activity is by bots, we return inconclusively
If any number of bot code changes are unreviewed, the score drops 3 points
If ==1 human change is unreviewed, the score drops by 7 points
If >1 human change is unreviewed, the score drops to 0

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

This takes Code-Review back to proportional scoring
If the only commit activity is by bots, we return inconclusively
If there is human and bot commit activity, but only bot commits are unreviewed, the score drops by 3 points
If all bot commits are reviewed, the score is based on the proportion of human commits that are unreviewed

Which issue(s) this PR fixes

Fixes #2812 .

Does this PR introduce a user-facing change?

* Code-Review: Use proportional instead of leveled scoring.

Signed-off-by: Raghav Kaul <raghavkaul@google.com>
@raghavkaul raghavkaul temporarily deployed to integration-test April 17, 2023 15:45 — with GitHub Actions Inactive
@codecov
Copy link

codecov bot commented Apr 17, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@e11fd2e). Click here to learn what that means.
The diff coverage is 97.36%.

❗ Current head 4e04572 differs from pull request most recent head bd52d48. Consider uploading reports for the commit bd52d48 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2882   +/-   ##
=======================================
  Coverage        ?   58.89%           
=======================================
  Files           ?      139           
  Lines           ?    11154           
  Branches        ?        0           
=======================================
  Hits            ?     6569           
  Misses          ?     4185           
  Partials        ?      400           

@naveensrinivasan
Copy link
Member

Isn't this the fix for #2812?

@raghavkaul
Copy link
Contributor Author

@naveensrinivasan Yes! Typo - fixed.

e2e/code_review_test.go Show resolved Hide resolved
checks/evaluation/code_review.go Show resolved Hide resolved
checks/evaluation/code_review.go Outdated Show resolved Hide resolved
checks/evaluation/code_review.go Show resolved Hide resolved
checks/evaluation/code_review.go Outdated Show resolved Hide resolved
clients/mockclients/repo_client.go Outdated Show resolved Hide resolved
e2e/code_review_test.go Outdated Show resolved Hide resolved
@raghavkaul raghavkaul temporarily deployed to integration-test April 26, 2023 20:51 — with GitHub Actions Inactive
Signed-off-by: Raghav Kaul <raghavkaul@google.com>
@raghavkaul raghavkaul temporarily deployed to integration-test April 26, 2023 20:54 — with GitHub Actions Inactive
Copy link
Contributor

@spencerschrock spencerschrock left a comment

Choose a reason for hiding this comment

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

If this is the desired scoring scheme, I think this PR looks good, but I think we should agree on the scoring though before merging as it seems like Azeem had different ideas in #2450 around if unreviewed bot PRs should be weighed differently.

I think the two approaches were:

  1. This sort of leveled scoring where an unreviewed bot PR drops the score to 7
  2. Just ignore reviewed (dependa)bot PRs to address the original problem in Wrong Scorecards result in CodeReview check due to Dependabot/RenovateBot PR reviews #2450, but otherwise use the same reviewed / total scoring we used before.
score = reviewed human / (reviewed human + any unreviewed )

I think there's value in the simplicity of 2, as we've had a few accidental scoring situations coding up this implementation. But ultimately I think we can come up with hypothetical "what if" scoring situations either way.

checks/evaluation/code_review.go Outdated Show resolved Hide resolved
checks/evaluation/code_review.go Outdated Show resolved Hide resolved
@github-actions
Copy link

github-actions bot commented May 8, 2023

Stale pull request message

Signed-off-by: Raghav Kaul <8695110+raghavkaul@users.noreply.github.com>
* exclude bot PRs from scoring
* missing import from merge

Signed-off-by: Raghav Kaul <raghavkaul@google.com>
@raghavkaul raghavkaul temporarily deployed to integration-test June 7, 2023 19:36 — with GitHub Actions Inactive
* changeset.Unknown

Signed-off-by: Raghav Kaul <raghavkaul@google.com>
@raghavkaul raghavkaul temporarily deployed to integration-test June 7, 2023 20:11 — with GitHub Actions Inactive
checks/evaluation/code_review.go Outdated Show resolved Hide resolved
checks/evaluation/code_review.go Outdated Show resolved Hide resolved
checks/evaluation/code_review_test.go Outdated Show resolved Hide resolved
Signed-off-by: Raghav Kaul <raghavkaul@google.com>
@raghavkaul raghavkaul temporarily deployed to integration-test June 12, 2023 14:54 — with GitHub Actions Inactive
Signed-off-by: Raghav Kaul <raghavkaul@google.com>
Signed-off-by: Raghav Kaul <raghavkaul@google.com>
@raghavkaul raghavkaul temporarily deployed to integration-test June 12, 2023 21:07 — with GitHub Actions Inactive
checks/evaluation/code_review.go Outdated Show resolved Hide resolved
checks/evaluation/code_review.go Outdated Show resolved Hide resolved
e2e/code_review_test.go Show resolved Hide resolved
raghavkaul and others added 2 commits June 14, 2023 15:01
Signed-off-by: Raghav Kaul <raghavkaul@google.com>
@raghavkaul raghavkaul enabled auto-merge (squash) June 14, 2023 15:02
@raghavkaul raghavkaul temporarily deployed to integration-test June 14, 2023 15:03 — with GitHub Actions Inactive
@raghavkaul raghavkaul merged commit 4cd5446 into ossf:main Jun 14, 2023
35 checks passed
ashearin pushed a commit to kgangerlm/scorecard-gitlab that referenced this pull request Nov 13, 2023
* Code Review: Use proportional scoring

Signed-off-by: Raghav Kaul <raghavkaul@google.com>

* address cr comments

Signed-off-by: Raghav Kaul <raghavkaul@google.com>

* revert repo_client.go

Signed-off-by: Raghav Kaul <raghavkaul@google.com>

* update

* exclude bot PRs from scoring
* missing import from merge

Signed-off-by: Raghav Kaul <raghavkaul@google.com>

* update

* changeset.Unknown

Signed-off-by: Raghav Kaul <raghavkaul@google.com>

* address pr comments

Signed-off-by: Raghav Kaul <raghavkaul@google.com>

* set field

Signed-off-by: Raghav Kaul <raghavkaul@google.com>

* fix unittests

Signed-off-by: Raghav Kaul <raghavkaul@google.com>

* update

Signed-off-by: Raghav Kaul <raghavkaul@google.com>

---------

Signed-off-by: Raghav Kaul <raghavkaul@google.com>
Signed-off-by: Raghav Kaul <8695110+raghavkaul@users.noreply.github.com>
Signed-off-by: Allen Shearin <allen.p.shearin@gmail.com>
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.

BUG (?): Large changes to Code-Review scores between 4.10.2 and 4.10.5
3 participants