File: detect_tabulations.sh

package info (click to toggle)
gdal 3.12.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 92,396 kB
  • sloc: cpp: 1,224,305; ansic: 206,456; python: 26,284; java: 6,001; xml: 4,769; sh: 3,869; cs: 2,513; yacc: 1,306; makefile: 214
file content (35 lines) | stat: -rwxr-xr-x 1,087 bytes parent folder | download | duplicates (3)
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