Skip to content

Commit 9e5e0a5

Browse files
authored
Merge pull request #116 from PennyLaneAI/sc-104689-upd-wae
Updating warning as errors
2 parents d5e1141 + 5186e4e commit 9e5e0a5

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

.github/workflows/scripts/unique_warning_reporter.sh

100644100755
Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,21 @@
44
# warnings-as-errors action runs. The volume of each reported warning can be used to indicate
55
# the severity or importance of rectification.
66

7-
JOBID=$(gh run list -w "Test-suite with Python warnings as errors" -L 1 --json databaseId -q '.[0].databaseId')
7+
JOBID=$(gh run list -w "Test-suite with Python warnings as errors" --repo PennylaneAI/pennylane -L 1 --json databaseId -q '.[0].databaseId')
88
echo "View latest job at https://github.com/PennyLaneAI/pennylane/actions/runs/$JOBID"
9-
gh run view $JOBID --log-failed >/tmp/job_$JOBID.out
10-
cat /tmp/job_$JOBID.out | grep "Warning:" | awk '{split($0,a,"Warning:"); print a[1]"Warning"}' | awk '{split($0,a," - "); print a[2]}' | sort -u >unique_wae.txt
9+
gh run view $JOBID --log-failed --repo PennylaneAI/pennylane >/tmp/job_$JOBID.out
1110

12-
declare -A waeCounts
13-
14-
while read -r line; do
15-
[[ -n "$line" && "$line" != [[:blank:]]* ]] && waeCounts["$line"]=$(cat /tmp/job_$JOBID.out | grep "$line" | wc -l)
16-
done <unique_wae.txt
17-
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
1817

1918
jsonOut="[{"
20-
for x in "${!waeCounts[@]}"; do
21-
echo $x :: ${waeCounts[$x]}
22-
jsonOut+="\"$x\":${waeCounts[$x]},"
23-
done
19+
while read -r name count; do
20+
echo "$name :: $count"
21+
jsonOut+="\"$name\":$count,"
22+
done < unique_wae.txt
2423
jsonOut="${jsonOut::-1}}]"
2524
echo $jsonOut >unique_wae.json

0 commit comments

Comments
 (0)