Files
fulpstation/tools/travis/check_grep.sh
spookydonut 4e8ff18b07 Fix Travis grep script to use PCRE to actually match things (#47065)
Several of the greps were missing the `-P` switch which caused them to 
fail to match things. The EOL grep also wasn't working right so I 
replaced it with the one I added to TGMC.
2019-10-19 10:21:05 -07:00

57 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
#nb: must be bash to support shopt globstar
shopt -s globstar
st=0
if grep -El '^\".+\" = \(.+\)' _maps/**/*.dmm; then
echo "ERROR: Non-TGM formatted map detected. Please convert it using Map Merger!"
st=1
fi;
if grep -P '^\ttag = \"icon' _maps/**/*.dmm; then
echo "ERROR: tag vars from icon state generation detected in maps, please remove them."
st=1
fi;
if grep -P 'step_[xy]' _maps/**/*.dmm; then
echo "ERROR: step_x/step_y variables detected in maps, please remove them."
st=1
fi;
if grep -P 'pixel_[xy] = 0' _maps/**/*.dmm; then
echo "WARNING: pixel_x/pixel_y = 0 variables detected in maps, please review to ensure they are not dirty varedits."
fi;
if grep -P '\td[1-2] =' _maps/**/*.dmm; then
echo "ERROR: d1/d2 cable variables detected in maps, please remove them."
st=1
fi;
if grep -P '^/area/.+[\{]' _maps/**/*.dmm; then
echo "ERROR: Vareditted /area path use detected in maps, please replace with proper paths."
st=1
fi;
if grep -P '\W\/turf\s*[,\){]' _maps/**/*.dmm; then
echo "ERROR: base /turf path use detected in maps, please replace with proper paths."
st=1
fi;
if grep -P '^/*var/' code/**/*.dm; then
echo "ERROR: Unmanaged global var use detected in code, please use the helpers."
st=1
fi;
if pcregrep --buffer-size=100K -LMr '\n$' code/**/*.dm; then
echo "ERROR: No newline at end of file detected"
st=1
fi;
if grep -P '^/[\w/]\S+\(.*(var/|, ?var/.*).*\)' code/**/*.dm; then
echo "WARNING: changed files contains proc argument starting with 'var'"
fi;
if grep -i 'centcomm' code/**/*.dm; then
echo "ERROR: Misspelling(s) of CENTCOM detected in code, please remove the extra M(s)."
st=1
fi;
if grep -i 'centcomm' _maps/**/*.dmm; then
echo "ERROR: Misspelling(s) of CENTCOM detected in maps, please remove the extra M(s)."
st=1
fi;
exit $st