Skip to content

chore: render all locations in UFM SARIF output#539

Draft
j-luong wants to merge 1 commit intomainfrom
chore/cli-1329_ufmSarifLocations
Draft

chore: render all locations in UFM SARIF output#539
j-luong wants to merge 1 commit intomainfrom
chore/cli-1329_ufmSarifLocations

Conversation

@j-luong
Copy link
Contributor

@j-luong j-luong commented Feb 4, 2026

No description provided.

@snyk-io
Copy link

snyk-io bot commented Feb 4, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@snyk-io
Copy link

snyk-io bot commented Feb 4, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

{{- if $locations }},
"locations": [
{{- if $location }}
{{- $locationsSize := sub (len $locations) 1 }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensuring no trailing comma on last item. using the same pattern for tags array

{
"fullyQualifiedName": {{ getQuotedString (index $logLoc "fullyQualifiedName") }}
}
}{{if lt $logLocIndex $logicalLocsSize}},{{end}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensures no trailing comma on last item

Comment on lines +66 to +69
{{- $location := "" }}
{{- $physicalLoc := "" }}
{{- $region := "" }}
{{- $artifactLocation := "" }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add default values to avoid potential panics

Comment on lines +139 to +150
{{- if $artifactLocation }}
"artifactLocation": {
"uri": {{ getQuotedString (index $artifactLocation "uri") }}
},
{{- end }}
"replacements": [
{
{{- if $region }}
"deletedRegion": {
"startLine": {{ index $region "startLine" }}
},
{{- end }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we depended on values from the 1st item in locations array here, not sure if this needs updating too

findings := issue.GetFindings()
if len(findings) == 0 {
// GetElementAtIndex returns an item from a slice at the given index
func GetElementAtIndex(slice []map[string]any, index int) map[string]any {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

introduced to maintain behaviour for "artifactChanges" SARIF property

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.

1 participant