File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -35,9 +35,9 @@ cd "$TOOL_DIR"
3535# Handle both path formats: with and without extra codacy-cli-v2
3636sed -i ' s|file:///home/runner/work/codacy-cli-v2/|file:///|g' actual.sarif
3737
38- # Sort rules by ID in both files
39- jq ' .runs[0].tool.driver.rules |= sort_by(.id)' expected.sarif > expected.sorted.json
40- jq ' .runs[0].tool.driver.rules |= sort_by(.id)' actual.sarif > actual.sorted.json
38+ # Sort all fields in both files, handling null rules array
39+ jq --sort-keys ' if .runs[0].tool.driver.rules == null then . else .runs[0].tool.driver.rules |= sort_by(.id) end ' expected.sarif > expected.sorted.json
40+ jq --sort-keys ' if .runs[0].tool.driver.rules == null then . else .runs[0].tool.driver.rules |= sort_by(.id) end ' actual.sarif > actual.sorted.json
4141
4242# Run diff and capture its exit code
4343if ! diff expected.sorted.json actual.sorted.json; then
You can’t perform that action at this time.
0 commit comments