Skip to content

Commit d9532c1

Browse files
eloymgCopilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent c39587f commit d9532c1

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

semgrep/format-results.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ echo ""
1717
echo "| Severity | Rule | File | Message |"
1818
echo "|----------|------|------|---------|"
1919

20-
jq -r --arg repo "$GITHUB_REPOSITORY" --arg branch "$GITHUB_BRANCH" '.results[] | {
20+
jq -r --arg repo "$GITHUB_REPOSITORY" --arg sha "$GITHUB_SHA" '.results[] | {
2121
sev: .extra.severity,
2222
rule: (.check_id | split(".")[-1]),
2323
path: .path,
2424
line: .start.line,
25-
msg: (.extra.message | gsub("\n"; " ") | ltrimstr(" ") | rtrimstr(" "))
25+
msg: (.extra.message | gsub("\n"; " ") | ltrimstr(" ") | rtrimstr(" ") | gsub("\\|"; "\\|") | gsub("`"; "\\`"))
2626
} | {
2727
icon: (if .sev == "CRITICAL" then "🔴"
2828
elif .sev == "HIGH" then "🟠"
@@ -35,4 +35,4 @@ jq -r --arg repo "$GITHUB_REPOSITORY" --arg branch "$GITHUB_BRANCH" '.results[]
3535
path: .path,
3636
line: .line,
3737
msg: .msg
38-
} | "| \(.icon) \(.sev) | `\(.rule)` | [`\(.path):\(.line)`](https://github.com/\($repo)/blob/\($branch)/\(.path)#L\(.line)) | \(.msg) |"' "$INPUT_FILE"
38+
} | "| \(.icon) \(.sev) | `\(.rule)` | [`\(.path):\(.line)`](https://github.com/\($repo)/blob/\($sha)/\(.path)#L\(.line)) | \(.msg) |"' "$INPUT_FILE"

0 commit comments

Comments
 (0)