Remove dead code from scorecard SARIF upload logic#822
Merged
justaugustus merged 1 commit intomainfrom Apr 21, 2026
Merged
Conversation
Remove unreachable functions found by deadcode analysis: - generateSARIF: superseded by refactored flow that passes *sc.Result to uploadSARIF which calls resultToSARIF directly - uploadToCodeScanning: wrapper bypassed by uploadSARIF which calls uploadToCodeScanningWithRef directly - ClearResults: exported but never called from any code path Also remove corresponding tests for the removed functions and clean up the unused clients import from sarif.go. The SARIF upload path remains fully connected: Check() -> uploadSARIF() -> resultToSARIF() + uploadToCodeScanningWithRef() Agent-Logs-Url: https://github.com/ossf/allstar/sessions/25e7e4f0-812e-4454-95db-5081af24b84d Co-authored-by: jeffmendoza <771387+jeffmendoza@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
jeffmendoza
April 21, 2026 15:53
View session
Closed
justaugustus
approved these changes
Apr 21, 2026
Member
justaugustus
left a comment
There was a problem hiding this comment.
Thanks for the catches, @jeffmendoza!
Filed this as a follow-up: #823
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
deadcode ./cmd/allstarflagged four unreachable functions inpkg/policies/scorecard/sarif.go. Git history investigation shows these are not accidentally orphaned — they were intentionally superseded in920cfa2whenuploadSARIFwas refactored to do commit-SHA change detection before the expensive scorecard run, which required inlining the logic fromgenerateSARIFand callinguploadToCodeScanningWithRefdirectly to avoid a double branch-info fetch.The production SARIF upload path is intact:
Check()→uploadSARIF()→resultToSARIF()+uploadToCodeScanningWithRef().Removed
generateSARIF— ranscRun()+resultToSARIF(); superseded whenuploadSARIFinlined this to gate on commit SHA firstuploadToCodeScanning— wrapper that fetched branch info then calleduploadToCodeScanningWithRef; superseded whenuploadSARIFstarted fetching branch info itself for change detectionClearResults— exported test utility, never called from any code pathTestGenerateSARIF,TestGenerateSARIFRunError,TestUploadToCodeScanning,TestUploadToCodeScanningAPIError)clientsimport fromsarif.goKept
clearSARIFHashes— actively used in test cleanup; expected deadcode from binary perspective