mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
improve jq bash shell error for clippy
Signed-off-by: Jerens Lensun <jerensslensun@gmail.com>
This commit is contained in:
parent
7c94cefd4b
commit
142b32a1e1
1 changed files with 6 additions and 9 deletions
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Usage: ./clippy-to-annotations.sh < input.json > output.json
|
||||
# Will exit with an error if there are no valid annotations.
|
||||
# Usage: ./mach clippy --message-format=json --use-crown --locked -- -- --deny warnings | ./etc/ci/clippy-annotation.sh > temp/clippy-output.json
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
|
@ -19,7 +18,7 @@ output=$(jq -c '
|
|||
$in.message.level
|
||||
| if . == "help" or . == "note" then "notice"
|
||||
elif . == "warning" then "warning"
|
||||
else "failure"
|
||||
else "error"
|
||||
end
|
||||
),
|
||||
title: $in.message.message,
|
||||
|
@ -36,10 +35,8 @@ output=$(jq -c '
|
|||
end
|
||||
' | jq -s '.')
|
||||
|
||||
if [[ "$output" == "[]" || -z "$output" ]]; then
|
||||
echo "❌ No annotations to output." >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Output the final result
|
||||
echo "$output"
|
||||
|
||||
if echo "$output" | jq -e 'map(select(.annotation_level == "error")) | length > 0' >/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue