mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +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
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Usage: ./clippy-to-annotations.sh < input.json > output.json
|
# Usage: ./mach clippy --message-format=json --use-crown --locked -- -- --deny warnings | ./etc/ci/clippy-annotation.sh > temp/clippy-output.json
|
||||||
# Will exit with an error if there are no valid annotations.
|
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
@ -19,7 +18,7 @@ output=$(jq -c '
|
||||||
$in.message.level
|
$in.message.level
|
||||||
| if . == "help" or . == "note" then "notice"
|
| if . == "help" or . == "note" then "notice"
|
||||||
elif . == "warning" then "warning"
|
elif . == "warning" then "warning"
|
||||||
else "failure"
|
else "error"
|
||||||
end
|
end
|
||||||
),
|
),
|
||||||
title: $in.message.message,
|
title: $in.message.message,
|
||||||
|
@ -36,10 +35,8 @@ output=$(jq -c '
|
||||||
end
|
end
|
||||||
' | jq -s '.')
|
' | jq -s '.')
|
||||||
|
|
||||||
if [[ "$output" == "[]" || -z "$output" ]]; then
|
|
||||||
echo "❌ No annotations to output." >&2
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Output the final result
|
|
||||||
echo "$output"
|
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