Skip to content

Commit 83a3346

Browse files
authored
print diff for new panics
Signed-off-by: Anton-4 <17049058+Anton-4@users.noreply.github.com>
1 parent 22b318e commit 83a3346

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

.github/workflows/improve_panics.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ jobs:
3333
path: target_branch_dir
3434
ref: ${{ github.base_ref }}
3535

36-
- name: Compare panics, expects, and unwraps between source and target brach
36+
- name: Compare panics, expects, and unwraps between source and target branch
3737
run: |
3838
for branch_dir in source_branch_dir target_branch_dir; do
3939
cd $branch_dir
40-
echo "Calculating violations in &branch_dir..."
41-
VIOLATIONS=$(nix develop -c cargo clippy --no-deps -- -W clippy::unwrap_used -W clippy::expect_used -W clippy::panic 2> >(grep -e "warning: \`panic\`" -e "warning: used" -e "warning: usage of" | wc -l ))
40+
echo "Calculating violations in $branch_dir..."
41+
VIOLATIONS=$(nix develop -c cargo clippy --no-deps -- -W clippy::unwrap_used -W clippy::expect_used -W clippy::panic 2> >(grep -e "warning: \`panic\`" -e "warning: used" -e "warning: usage of" | tee violations.txt | wc -l ))
4242
echo $VIOLATIONS > violations
4343
cd ..
4444
done
@@ -49,6 +49,9 @@ jobs:
4949
echo "You added panic/unwrap/expect, in this PR their count increased from $TARGET_VIOLATIONS to $SOURCE_VIOLATIONS."
5050
echo "These calls can kill the REPL, try alternative error handling."
5151
echo ""
52+
echo "New violations:"
53+
diff target_branch_dir/violations.txt source_branch_dir/violations.txt | grep "^>" || true
54+
echo ""
5255
echo "TIP: Ask AI \"In rust, how can I rewrite code that contains panic or unwrap so it doesn't crash?\""
5356
echo ""
5457
echo "If you believe your panic/unwrap/expect is justified, ask Anton-4, rtfeldman or lukewilliamboswell to bypass this workflow failure."

0 commit comments

Comments
 (0)