diff --git a/tools/ci/validate_files.sh b/tools/ci/validate_files.sh index e40decdc2b..c932b7dcca 100755 --- a/tools/ci/validate_files.sh +++ b/tools/ci/validate_files.sh @@ -22,16 +22,14 @@ if command -v rg >/dev/null 2>&1; then pcre2_support=0 fi code_files="code/**/**.dm modular_chomp/code/**/**.dm" # CHOMPEdit - Modular code - map_files="maps/**/**.dmm" - modular_map_files="modular_chomp/maps/**/**.dmm" # CHOMPEdit - Modular maps + map_files="maps/**/**.dmm modular_chomp/maps/**/**.dmm" # CHOMPEdit - Modular maps # shuttle_map_files="_maps/shuttles/**.dmm" code_x_515="code/**/!(__byond_version_compat).dm" else pcre2_support=0 grep=grep code_files="-r --include=code/**/**.dm --include=modular_chomp/code/**/**.dm" # CHOMPEdit - Modular code - map_files="-r --include=maps/**/**.dmm" - modular_map_files="-r --include=modular_chomp/maps/**/**.dmm" # CHOMPEdit - Modular maps + map_files="-r --include=maps/**/**.dmm --include=modular_chomp/maps/**/**.dmm" # CHOMPEdit - Modular maps # shuttle_map_files="-r --include=_maps/shuttles/**.dmm" code_x_515="-r --include=code/**/!(__byond_version_compat).dm" fi @@ -52,6 +50,20 @@ part() { section "map issues" +part "TGM" +if grep -El '^\".+\" = \(.+\)' $map_files; then + echo + echo -e "${RED}ERROR: Non-TGM formatted map detected. Please convert it using Map Merger!${NC}" + FAILED=1 +fi; + +part "iconstate tags" +if grep -P '^\ttag = \"icon' $map_files; then + echo + echo -e "${RED}ERROR: tag vars from icon state generation detected in maps, please remove them.${NC}" + FAILED=1 +fi; + part "step_[xy]" #Checking for step_x/step_y defined in any maps anywhere. (! $grep 'step_[xy]' $map_files) @@ -61,6 +73,20 @@ if [ $retVal -ne 0 ]; then FAILED=1 fi +part "wrongly offset APCs" +if grep -Pzo '/obj/structure/machinery/power/apc[/\w]*?\{\n[^}]*?pixel_[xy] = -?[013-9]\d*?[^\d]*?\s*?\},?\n' $map_files || + grep -Pzo '/obj/structure/machinery/power/apc[/\w]*?\{\n[^}]*?pixel_[xy] = -?\d+?[0-46-9][^\d]*?\s*?\},?\n' $map_files || + grep -Pzo '/obj/structure/machinery/power/apc[/\w]*?\{\n[^}]*?pixel_[xy] = -?\d{3,1000}[^\d]*?\s*?\},?\n' $map_files ; then + echo -e "${RED}ERROR: found an APC with a manually set pixel_x or pixel_y that is not +-25.${NC}" + FAILED=1 +fi; + +part "vareditted areas" +if grep -P '^/area/.+[\{]' $map_files; then + echo -e "${RED}ERROR: Vareditted /area path use detected in maps, please replace with proper paths.${NC}" + FAILED=1 +fi; + part "base /turf usage" if grep -P '\W\/turf\s*[,\){]' $map_files; then echo @@ -164,6 +190,20 @@ if [ $retVal -ne 0 ]; then FAILED=1 fi +part "proc ref syntax" +if $grep '\.proc/' $code_x_515 ; then + echo + echo -e "${RED}ERROR: Outdated proc reference use detected in code, please use proc reference helpers.${NC}" + FAILED=1 +fi; + +part "ambiguous bitwise or" +if grep -P '^(?:[^\/\n]|\/[^\/\n])*(&[ \t]*\w+[ \t]*\|[ \t]*\w+)' $code_files; then + echo + echo -e "${RED}ERROR: Likely operator order mistake with bitwise OR. Use parentheses to specify intention.${NC}" + FAILED=1 +fi; + if [ "$pcre2_support" -eq 1 ]; then section "regexes requiring PCRE2" @@ -211,7 +251,7 @@ if [ "$pcre2_support" -eq 1 ]; then FAILED=1 fi - (! $grep -Pn '( |\t|;|{)tag( ?)=' $modular_map_files) + (! $grep -Pn '( |\t|;|{)tag( ?)=' $map_files) retVal=$? if [ $retVal -ne 0 ]; then echo -e "${RED}A map has 'tag' set on an atom. It may cause problems and should be removed.${NC}"