Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions layer4/evaluation_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"github.com/ossf/gemara/layer2"
)

var emptyArtifactURIMessage = "no file associated with this alert"

// ToSARIF converts the evaluation results into a SARIF document (v2.1.0).
// Each AssessmentLog is emitted as a SARIF result. The rule id is derived from
// the control id and requirement id.
Expand Down Expand Up @@ -104,13 +106,13 @@ func (e EvaluationLog) ToSARIF(artifactURI string, catalog *layer2.Catalog) ([]b
}

var physicalLocation *PhysicalLocation
if artifactURI != "" {
physicalLocation = &PhysicalLocation{
ArtifactLocation: ArtifactLocation{
URI: artifactURI,
},
// Region left nil - no line/column data available
}
if artifactURI == "" {
artifactURI = emptyArtifactURIMessage
}
physicalLocation = &PhysicalLocation{
ArtifactLocation: ArtifactLocation{
URI: artifactURI,
},
}

// Use the last AssessmentStep for LogicalLocation (the location is for the entire evaluation)
Expand Down
Loading
Loading