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

🐛 handle gitlab repos with no commits #3731

Merged
merged 6 commits into from
Jan 4, 2024

Conversation

ashearin
Copy link
Contributor

@ashearin ashearin commented Dec 12, 2023

What kind of change does this PR introduce?

Simple length check on raw commit array prior to attempting to access the first index

What is the current behavior?

It's assumed that the repository will return commits, sets the first element as the 'before' time for future processing.

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

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

Which issue(s) this PR fixes

Fixes #3727
Related to #3193

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.)

Scorecard no longer crashes on GitLab repos with no commits

Signed-off-by: Allen Shearin <allen.p.shearin@gmail.com>
Copy link

codecov bot commented Dec 12, 2023

Codecov Report

Merging #3731 (fd2eaed) into main (658a77b) will decrease coverage by 5.03%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3731      +/-   ##
==========================================
- Coverage   75.93%   70.91%   -5.03%     
==========================================
  Files         229      229              
  Lines       15377    15380       +3     
==========================================
- Hits        11677    10907     -770     
- Misses       2978     3805     +827     
+ Partials      722      668      -54     

@spencerschrock
Copy link
Member

Is draft status intentional?

@ashearin ashearin marked this pull request as ready for review December 19, 2023 18:54
@ashearin ashearin requested a review from a team as a code owner December 19, 2023 18:54
@ashearin ashearin requested review from justaugustus and raghavkaul and removed request for a team December 19, 2023 18:54
@gabibguti
Copy link
Contributor

Can we add a test for this ListCommits test case in clients/gitlabrepo/client_test.go?

Signed-off-by: Allen Shearin <allen.p.shearin@gmail.com>
Copy link
Member

@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.

Change looks good, left two small comments about the tests.

clients/gitlabrepo/client_test.go Outdated Show resolved Hide resolved
clients/gitlabrepo/client_test.go Outdated Show resolved Hide resolved
@spencerschrock spencerschrock merged commit 141ac4d into ossf:main Jan 4, 2024
41 checks passed
@ashearin ashearin deleted the no-commits-bug branch January 8, 2024 17:32
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: Scanning a gitlab project with no commits crashes
3 participants