Files
MokoCassiopeia/scripts/validate/tabs.sh
copilot-swe-agent[bot] 5779dcb73e Fix CI validation scripts: correct heredoc quoting, CRLF robustness, and path detection
- Replace version_alignment.sh with simplified version using quoted heredoc (<<'PY')
- Replace tabs.sh with bash-native implementation using safe loops and grep
- Replace paths.sh with git ls-files -z based implementation for binary-safe processing
- All scripts now handle CRLF line endings correctly
- Quoted heredocs prevent shell interpolation issues
- Scripts successfully detect their target conditions (tabs, windows paths, version mismatches)

Co-authored-by: jmiller-moko <230051081+jmiller-moko@users.noreply.github.com>
2026-01-03 20:57:59 +00:00

29 lines
580 B
Bash

#!/usr/bin/env bash
set -euo pipefail
# Detect TAB characters in source files tracked by Git. Uses careful
# handling of filenames and avoids heredoc pitfalls.
# Limit file globs as appropriate for the repo
files=$(git ls-files '*.php' '*.js' '*.py' || true)
if [ -z "${files}" ]; then
echo "No files to check"
exit 0
fi
bad=0
while IFS= read -r f; do
if grep -n $'\t' -- "$f" >/dev/null 2>&1; then
echo "TAB found in $f"
bad=1
fi
done <<< "${files}"
if [ "${bad}" -ne 0 ]; then
echo "ERROR: Tabs found in repository files" >&2
exit 2
fi
echo "tabs: ok"