mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
95b74eefdf
Manual hook added which runs a shell script. Can be run locally manually by Linux or Mac users and we have this also running on the GitHub Actions CI. Will fail if Makefiles uses spaces for indentation. Can run the manual hooks with: `pre-commit run check-makefile-indentation --all-files --hook-stage manual`
14 lines
381 B
Bash
Executable File
14 lines
381 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Iterate over all files passed as arguments by pre-commit
|
|
for makefile in "$@"; do
|
|
# Check if the file exists and is a regular file
|
|
if [[ -f "$makefile" ]]; then
|
|
if grep -P '^\s' "$makefile" | grep -vP '^\t' > /dev/null; then
|
|
echo "Error: File '$makefile' contains spaces at the beginning of lines instead of tabs."
|
|
exit 1
|
|
fi
|
|
fi
|
|
done
|
|
exit 0
|