Files
Paradise/tools/ci/check_grep.sh
T
036a69fea4 Removes pixel_* = 0 and tag = "icon*" from the map files (#15438)
* Pixel Removal

Co-Authored-By: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>

* Fix

Why is that even there?

* Fix

Apparently I did the regex stuff in the wrong order for `Lavaland.dm`. Whoops

* Unit tests

* Mother of all map edits

* `tag = "icon` purging

* No area check

Far too much code debt for this PR to cover, but soon...

* At request

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
2021-07-14 23:07:12 +01:00

46 lines
1.2 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 'pixel_[^xy]' _maps/**/*.dmm; then
echo "ERROR: Incorrect pixel offset variables 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 '^/[\w/]\S+\(.*(var/|, ?var/.*).*\)' code/**/*.dm; then
echo "ERROR: Changed files contains proc arguments with implicit 'var/', please remove them."
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;
nl='
'
nl=$'\n'
while read f; do
t=$(tail -c2 "$f"; printf x); r1="${nl}$"; r2="${nl}${r1}"
if [[ ! ${t%x} =~ $r1 ]]; then
echo "file $f is missing a trailing newline"
st=1
fi;
done < <(find . -type f -name '*.dm')
exit $st