mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-10-18 19:10:30 +08:00
Add custom check for ellipses "...", asking for replacement of "…". Git ranges and the CLI wildcard matches are ignored. This change includes fixes to all sites that did not pass the check.
29 lines
924 B
Bash
Executable File
29 lines
924 B
Bash
Executable File
#! /usr/bin/env bash
|
|
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
|