Skip to content

Commit 5186e4e

Browse files
committed
dynamic warnings
1 parent 4742058 commit 5186e4e

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

.github/workflows/scripts/unique_warning_reporter.sh

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,17 @@ JOBID=$(gh run list -w "Test-suite with Python warnings as errors" --repo Pennyl
88
echo "View latest job at https://github.com/PennyLaneAI/pennylane/actions/runs/$JOBID"
99
gh run view $JOBID --log-failed --repo PennylaneAI/pennylane >/tmp/job_$JOBID.out
1010

11-
cat <<EOF > unique_wae.txt
12-
FutureWarning
13-
pennylane.exceptions.PennyLaneDeprecationWarning
14-
pytest.PytestCollectionWarning
15-
RuntimeWarning
16-
numpy.exceptions.ComplexWarning
17-
pytest.PytestUnraisableExceptionWarning
18-
PendingDeprecationWarning
19-
pytest.PytestRemovedIn9Warning
20-
UserWarning
21-
DeprecationWarning
22-
EOF
23-
24-
declare -A waeCounts
25-
26-
while read -r line; do
27-
[[ -n "$line" && "$line" != [[:blank:]]* ]] && waeCounts["$line"]=$(grep -F -c "$line" "/tmp/job_$JOBID.out")
28-
done <unique_wae.txt
29-
echo $waeCounts
11+
grep -oE ' [A-Za-z0-9_.]+Warning:' /tmp/job_$JOBID.out | \
12+
sed 's/^ //' | \
13+
sed 's/:$//' | \
14+
sort | \
15+
uniq -c | \
16+
awk '{print $2, $1}' > unique_wae.txt
3017

3118
jsonOut="[{"
32-
for x in "${!waeCounts[@]}"; do
33-
echo $x :: ${waeCounts[$x]}
34-
jsonOut+="\"$x\":${waeCounts[$x]},"
35-
done
19+
while read -r name count; do
20+
echo "$name :: $count"
21+
jsonOut+="\"$name\":$count,"
22+
done < unique_wae.txt
3623
jsonOut="${jsonOut::-1}}]"
3724
echo $jsonOut >unique_wae.json

0 commit comments

Comments
 (0)