This is an automated email from the ASF dual-hosted git repository.

jiayu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sedona.git


The following commit(s) were added to refs/heads/master by this push:
     new f8e37a688f [CI] pre-commit: add hook to check Makefiles are indented 
with tabs (#2206)
f8e37a688f is described below

commit f8e37a688f37cce489854f4719d90a2b749ea1bf
Author: John Bampton <[email protected]>
AuthorDate: Fri Aug 1 04:09:10 2025 +1000

    [CI] pre-commit: add hook to check Makefiles are indented with tabs (#2206)
---
 .pre-commit-config.yaml                        |  8 ++++++++
 scripts/pre-commit/check_makefiles_for_tabs.sh | 14 ++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 5cc26f70cc..62fbef4147 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -67,6 +67,14 @@ repos:
           Zip files are not allowed in the repository as they are hard to
           track and have security implications. Please remove the zip file 
from the repository.
         files: (?i)\.zip$
+      - id: check-makefiles-tabs
+        name: check Makefiles files for tabs
+        entry: ./scripts/pre-commit/check_makefiles_for_tabs.sh # Path to your 
script
+        language: system
+        files: '(?i)makefile$'
+        pass_filenames: true # <-- Crucial change: pass filenames to the script
+        types: [file] # Ensure only regular files are passed, not directories
+        stages: [manual]
   - repo: https://github.com/Lucas-C/pre-commit-hooks
     rev: v1.5.5
     hooks:
diff --git a/scripts/pre-commit/check_makefiles_for_tabs.sh 
b/scripts/pre-commit/check_makefiles_for_tabs.sh
new file mode 100755
index 0000000000..b5d30f5d06
--- /dev/null
+++ b/scripts/pre-commit/check_makefiles_for_tabs.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+# check_makefiles_for_tabs.sh
+
+# 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

Reply via email to