Files
heartwood/scripts/just/check-keywords.sh
T
Lorenz Leutgeb c7d71df4ab scripts, build, just: POSIX Compliance
Enforce POSIX shell syntax with ShellCheck using `--shell sh`.
2026-10-30 12:45:40 +01:00

29 lines
922 B
Bash
Executable File

#! /usr/bin/env sh
set -e
echo "${CHECK}Checking for forbidden words in staged files…${NORMAL}"
# Get staged Rust files
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR | grep '\.rs$' || true)
if [ -n "$STAGED_FILES" ]; then
if echo "$STAGED_FILES" | xargs rg --context=3 --fixed-strings 'radicle.dev'; then
exit 1
fi
if echo "$STAGED_FILES" | xargs rg --context=3 --fixed-strings 'radicle.xyz'; then
exit 1
fi
if echo "$STAGED_FILES" | xargs rg --context=3 --fixed-strings 'radicle.zulipchat.com'; then
exit 1
fi
# For `git2::` we need to exclude raw.rs
FILTERED_GIT2=$(echo "$STAGED_FILES" | grep '^crates/radicle/.*\.rs$' | grep -v 'crates/radicle/src/git/raw.rs' || true)
if [ -n "$FILTERED_GIT2" ]; then
if echo "$FILTERED_GIT2" | xargs rg --context=3 --fixed-strings 'git2::'; then
exit 1
fi
fi
fi