in codecatalyst-runner/pkg/workflows/report_processor.go [132:158]
func convertLocations(sarifLocations []*sarif.Location) []Location {
if sarifLocations == nil {
return nil
}
locations := make([]Location, 0)
for _, l := range sarifLocations {
if l == nil {
continue
}
location := Location{}
if l.PhysicalLocation != nil {
if l.PhysicalLocation.ArtifactLocation != nil {
location.URI = safeString(l.PhysicalLocation.ArtifactLocation.URI)
}
if l.PhysicalLocation.Region != nil {
location.StartLine = l.PhysicalLocation.Region.StartLine
location.EndLine = l.PhysicalLocation.Region.EndLine
if l.PhysicalLocation.Region.Snippet != nil {
location.Snippet = safeString(l.PhysicalLocation.Region.Snippet.Text)
}
}
}
locations = append(locations, location)
}
return locations
}