-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
Copy pathdetect_tabulations.sh
executable file
·35 lines (29 loc) · 1.06 KB
/
detect_tabulations.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
set -eu
SCRIPT_DIR=$(dirname "$0")
case $SCRIPT_DIR in
"/"*)
;;
".")
SCRIPT_DIR=$(pwd)
;;
*)
SCRIPT_DIR=$(pwd)/$(dirname "$0")
;;
esac
GDAL_ROOT=$SCRIPT_DIR/..
cd "$GDAL_ROOT"
ret_code=0
echo "Checking for tabulation characters..."
if grep -r --files-with-matches -P --include='*.h' --include='*.cpp' --include='*.cmake' --include='CMakeLists.txt' '\t' cmake alg gnm port ogr gcore frmts apps | grep -v -e frmts/msg/PublicDecompWT -e frmts/jpeg/libjpeg -e frmts/gtiff/libtiff -e frmts/gtiff/libgeotiff -e frmts/grib/degrib -e ogr/ogrsf_frmts/geojson/libjson -e frmts/hdf4/hdf-eos -e frmts/gif/giflib -e frmts/pcraster/libcsf -e frmts/png/libpng -e cpl_mem_cache -e cmake/modules/thirdparty -e ogr/ogrsf_frmts/pmtiles/pmtiles/; then
ret_code=1
fi
if grep -r --files-with-matches -P --include='*.cmake' --include='CMakeLists.txt' '\t' swig; then
ret_code=1
fi
if test "$ret_code" = "1"; then
echo "FAIL: tabulations detected. Please remove them!"
else
echo "OK: no tabulations found."
fi
exit $ret_code