Skip to content

Commit ada4d02

Browse files
committed
Show clippy diagnostics in lint script
1 parent 4b90892 commit ada4d02

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

lint.sh

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,27 @@ filter_vendored() {
2424
awk 'BEGIN{RS=""; ORS="\n\n"} !/\/noodles\/|\/vendor\/|`noodles-|`lexical-/'
2525
}
2626

27-
cargo clippy "${PKG_ARGS[@]}" --all-targets --color=never -- -D warnings 2> >(filter_vendored >&2)
27+
CLIPPY_STDERR="$(mktemp)"
28+
FILTERED_STDERR="$(mktemp)"
29+
cleanup() {
30+
rm -f "$CLIPPY_STDERR" "$FILTERED_STDERR"
31+
}
32+
trap cleanup EXIT
33+
34+
set +e
35+
cargo clippy "${PKG_ARGS[@]}" --all-targets --color=never -- -D warnings 2> "$CLIPPY_STDERR"
36+
CLIPPY_STATUS=$?
37+
set -e
38+
39+
filter_vendored < "$CLIPPY_STDERR" > "$FILTERED_STDERR"
40+
if [[ -s "$FILTERED_STDERR" ]]; then
41+
cat "$FILTERED_STDERR" >&2
42+
elif [[ "$CLIPPY_STATUS" -ne 0 ]]; then
43+
cat "$CLIPPY_STDERR" >&2
44+
fi
45+
46+
if [[ "$CLIPPY_STATUS" -ne 0 ]]; then
47+
exit "$CLIPPY_STATUS"
48+
fi
2849

2950
cargo test -p bioscript-core --test source_size -- --nocapture

0 commit comments

Comments
 (0)