| skipped 17 lines |
18 | 18 | | "encoding/json" |
19 | 19 | | "fmt" |
20 | 20 | | "io" |
| 21 | + | "os" |
21 | 22 | | "sort" |
22 | 23 | | "strings" |
23 | 24 | | "time" |
| skipped 7 lines |
31 | 32 | | sce "github.com/ossf/scorecard/v4/errors" |
32 | 33 | | "github.com/ossf/scorecard/v4/finding" |
33 | 34 | | "github.com/ossf/scorecard/v4/log" |
| 35 | + | "github.com/ossf/scorecard/v4/options" |
34 | 36 | | spol "github.com/ossf/scorecard/v4/policy" |
35 | 37 | | ) |
36 | 38 | | |
| skipped 569 lines |
606 | 608 | | return messageWithScore(check.Reason, score) |
607 | 609 | | } |
608 | 610 | | |
| 611 | + | func toolName(opts *options.Options) string { |
| 612 | + | if opts.IsInternalGitHubIntegrationEnabled() { |
| 613 | + | return strings.TrimSpace(os.Getenv("SCORECARD_INTERNAL_GITHUB_SARIF_TOOL_NAME")) |
| 614 | + | } |
| 615 | + | return "scorecard" |
| 616 | + | } |
| 617 | + | |
609 | 618 | | // AsSARIF outputs ScorecardResult in SARIF 2.1.0 format. |
610 | 619 | | func (r *ScorecardResult) AsSARIF(showDetails bool, logLevel log.Level, |
611 | 620 | | writer io.Writer, checkDocs docs.Doc, policy *spol.ScorecardPolicy, |
| 621 | + | opts *options.Options, |
612 | 622 | | ) error { |
613 | 623 | | //nolint |
614 | 624 | | // https://docs.oasis-open.org/sarif/sarif/v2.1.0/cs01/sarif-v2.1.0-cs01.html. |
| skipped 20 lines |
635 | 645 | | if err != nil { |
636 | 646 | | return sce.WithMessage(sce.ErrScorecardInternal, fmt.Sprintf("computeCategory: %v: %s", err, check.Name)) |
637 | 647 | | } |
638 | | - | run := getOrCreateSARIFRun(runs, category, "https://github.com/ossf/scorecard", "scorecard", |
| 648 | + | run := getOrCreateSARIFRun(runs, category, "https://github.com/ossf/scorecard", toolName(opts), |
639 | 649 | | r.Scorecard.Version, r.Scorecard.CommitSHA, r.Date, "supply-chain") |
640 | 650 | | |
641 | 651 | | // Always add rules to indicate which checks were run. |
| skipped 70 lines |