Skip to content

Commit ed1ea03

Browse files
committed
ci: add no-spanish pre-commit hook and zsh-safe green gate
1 parent c6c4fff commit ed1ea03

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,10 @@ repos:
2828
pass_filenames: false
2929
types_or:
3030
[javascript, jsx, ts, tsx, json, markdown, yaml, css, scss, html]
31+
- repo: local
32+
hooks:
33+
- id: no-spanish
34+
name: no Spanish content (warn)
35+
entry: scripts/no_spanish.sh
36+
language: system
37+
pass_filenames: false

scripts/no_spanish.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
# Warn if Spanish text sneaks into the codebase (default warn-only).
3+
set -u
4+
STRICT="${STRICT:-0}"
5+
EXCLUDES=(
6+
--exclude-dir .git --exclude-dir node_modules --exclude-dir _ci_local
7+
)
8+
PATTERN='[áéíóúÁÉÍÓÚñÑ¿¡]|<(es|span)>' # diacríticos y tags HTML
9+
rg -n -S "${EXCLUDES[@]}" -e "$PATTERN" . || EXIT=$?
10+
if [ "${EXIT:-0}" -ne 0 ]; then exit 0; fi
11+
echo "Spanish-like text detected above."
12+
[ "$STRICT" = "1" ] && exit 1 || exit 0

0 commit comments

Comments
 (0)