Skip to content

Commit

Permalink
Add sanity check to tell us if we're using log::warn! directly
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov authored and nathanwhit committed Jan 6, 2023
1 parent 44aaaa1 commit b24784d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ jobs:
run: |
./scripts/check-parity-bw-extrinsics-benchmarks-weights.sh
- name: Check for direct usage of log::warn vs. warn_or_panic in migrations
run: |
./scripts/check-usage-of-log-warn.sh
fmt:
name: Rustfmt
runs-on: ubuntu-latest
Expand Down
14 changes: 14 additions & 0 deletions scripts/check-usage-of-log-warn.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -xeuo pipefail

# shellcheck disable=SC2038
OUTPUT=$(find . -wholename "*/migrations/*.rs" | xargs grep "log::warn" || true)
if [ -n "$OUTPUT" ]; then
echo "FAIL"
echo "$OUTPUT"
exit 1
fi

echo "PASS"
exit 0

0 comments on commit b24784d

Please sign in to comment.