Files
rust_browser/scripts/check_unsafe.sh
Zachary D. Rowitsch e589101a2e Refactor rasterizer/tests.rs into focused submodules
Split the 2,246-line monolithic test file (82 tests) into 8 focused
submodules under tests/: pixel_buffer, fill_rect, border, border_style,
text, image, box_shadow, and display_list tests.

Also harden CI scripts (check_file_size.sh, check_unsafe.sh, metrics.sh)
to skip deleted-but-unstaged files when iterating git ls-files output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 20:51:21 -05:00

27 lines
566 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
ALLOWLIST_RE='^(crates/(platform|graphics)/)'
fail=0
while IFS= read -r f; do
[[ -f "$f" ]] || continue
if [[ "$f" =~ $ALLOWLIST_RE ]]; then
continue
fi
if rg -n "\bunsafe\b" "$f" >/dev/null; then
echo "ERROR: unsafe found outside allowlist: $f"
rg -n "\bunsafe\b" "$f" || true
fail=1
fi
done < <(git ls-files '*.rs')
if [[ $fail -ne 0 ]]; then
echo
echo "Unsafe policy: unsafe is only allowed under crates/platform/** and crates/graphics/**"
exit 1
fi
echo "OK: unsafe policy check passed"