From 79be389db1ebef1ada4ec7896971f5794eb19078 Mon Sep 17 00:00:00 2001
From: CHOMPStation2StaffMirrorBot
<94713762+CHOMPStation2StaffMirrorBot@users.noreply.github.com>
Date: Fri, 14 Mar 2025 17:01:16 -0700
Subject: [PATCH] [MIRROR] first few resolved greps (#10417)
Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
---
code/__byond_version_compat.dm | 5 +-
code/_onclick/hud/action/action.dm | 2 +-
code/controllers/subsystems/vote.dm | 2 +-
code/datums/callback.dm | 8 +-
code/modules/client/client procs.dm | 2 +-
.../mob/living/simple_mob/simple_mob.dm | 2 +-
.../simple_mob/subtypes/animal/space/worm.dm | 2 +-
.../simple_mob/subtypes/mechanical/golem.dm | 2 +-
code/modules/xenobio/items/slimepotions.dm | 6 +-
tools/ci/validate_files.sh | 89 +++++++++++--------
10 files changed, 70 insertions(+), 50 deletions(-)
diff --git a/code/__byond_version_compat.dm b/code/__byond_version_compat.dm
index fd9fc5835b..5c8ac846f3 100644
--- a/code/__byond_version_compat.dm
+++ b/code/__byond_version_compat.dm
@@ -19,8 +19,9 @@
// Keep savefile compatibilty at minimum supported level
/savefile/byond_version = MIN_COMPILER_VERSION
-// So we want to have compile time guarantees these methods exist on local type
-// We use wrappers for this in case some part of the api ever changes, and to make their function more clear
+// lib call for external libraries into call_ext
+#define LIBCALL call_ext
+
// For the record: GLOBAL_VERB_REF would be useless as verbs can't be global.
/// Call by name proc references, checks if the proc exists on either this type or as a global proc.
diff --git a/code/_onclick/hud/action/action.dm b/code/_onclick/hud/action/action.dm
index a5a512be68..77975659e4 100644
--- a/code/_onclick/hud/action/action.dm
+++ b/code/_onclick/hud/action/action.dm
@@ -58,7 +58,7 @@
RegisterSignal(target, COMSIG_ATOM_UPDATED_ICON, PROC_REF(on_target_icon_update))
// if(istype(target, /datum/mind))
- // RegisterSignal(target, COMSIG_MIND_TRANSFERRED, .proc/on_target_mind_swapped)
+ // RegisterSignal(target, COMSIG_MIND_TRANSFERRED, PROC_REF(on_target_mind_swapped))
/datum/action/Destroy()
if(owner)
diff --git a/code/controllers/subsystems/vote.dm b/code/controllers/subsystems/vote.dm
index e89ff752d2..0ba1852dd7 100644
--- a/code/controllers/subsystems/vote.dm
+++ b/code/controllers/subsystems/vote.dm
@@ -284,7 +284,7 @@ SUBSYSTEM_DEF(vote)
return
var/admin = FALSE
if(C.holder)
- if(C.holder.rights & R_ADMIN|R_EVENT)
+ if(C.holder.rights & (R_ADMIN|R_EVENT))
admin = TRUE
. = "
Voting Panel"
diff --git a/code/datums/callback.dm b/code/datums/callback.dm
index dd7bc02f1f..68b53ca415 100644
--- a/code/datums/callback.dm
+++ b/code/datums/callback.dm
@@ -22,20 +22,20 @@
global proc while in another global proc:
.procname
Example:
- CALLBACK(GLOBAL_PROC, .some_proc_here)
+ CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(some_proc_here))
proc defined on current(src) object (when in a /proc/ and not an override) OR overridden at src or any of it's parents:
.procname
Example:
- CALLBACK(src, .some_proc_here)
+ CALLBACK(src, PROC_REF(some_proc_here))
when the above doesn't apply:
PROC_REF(procname)
Example:
- CALLBACK(src, PROC_REF(some_proc_here))
+ CALLBACK(src,
proc defined on a parent of a some type:
- Example: /some/type/PROC_REF(some_proc_here)
+ Example: TYPE_PROC_REF(/some/type, some_proc_here))
Other wise you will have to do the full typepath of the proc (/type/of/thing/proc/procname)
*/
diff --git a/code/modules/client/client procs.dm b/code/modules/client/client procs.dm
index 62cecb8f16..36ff0deab8 100644
--- a/code/modules/client/client procs.dm
+++ b/code/modules/client/client procs.dm
@@ -252,7 +252,7 @@
// Instantiate stat panel
stat_panel = new(src, "statbrowser")
- stat_panel.subscribe(src, .proc/on_stat_panel_message)
+ stat_panel.subscribe(src, PROC_REF(on_stat_panel_message))
// Instantiate tgui panel
tgui_say = new(src, "tgui_say")
diff --git a/code/modules/mob/living/simple_mob/simple_mob.dm b/code/modules/mob/living/simple_mob/simple_mob.dm
index 6fdd3c55fd..73ebdd9dae 100644
--- a/code/modules/mob/living/simple_mob/simple_mob.dm
+++ b/code/modules/mob/living/simple_mob/simple_mob.dm
@@ -325,7 +325,7 @@
return verb
/mob/living/simple_mob/is_sentient()
- return mob_class & MOB_CLASS_HUMANOID|MOB_CLASS_ANIMAL|MOB_CLASS_SLIME // Update this if needed.
+ return mob_class & (MOB_CLASS_HUMANOID|MOB_CLASS_ANIMAL|MOB_CLASS_SLIME) // Update this if needed.
/mob/living/simple_mob/get_nametag_desc(mob/user)
return span_italics("[tt_desc]")
diff --git a/code/modules/mob/living/simple_mob/subtypes/animal/space/worm.dm b/code/modules/mob/living/simple_mob/subtypes/animal/space/worm.dm
index 51889a01a0..db80dffebb 100644
--- a/code/modules/mob/living/simple_mob/subtypes/animal/space/worm.dm
+++ b/code/modules/mob/living/simple_mob/subtypes/animal/space/worm.dm
@@ -268,7 +268,7 @@
objectOrMob = null
break
- if(D && (D.stat & BROKEN|NOPOWER))
+ if(D && (D.stat & (BROKEN|NOPOWER)))
D.open(TRUE)
break
diff --git a/code/modules/mob/living/simple_mob/subtypes/mechanical/golem.dm b/code/modules/mob/living/simple_mob/subtypes/mechanical/golem.dm
index 9288734be4..2164ad9bc4 100644
--- a/code/modules/mob/living/simple_mob/subtypes/mechanical/golem.dm
+++ b/code/modules/mob/living/simple_mob/subtypes/mechanical/golem.dm
@@ -115,7 +115,7 @@
return ..()
/mob/living/simple_mob/mechanical/technomancer_golem/melee_pre_animation(atom/A)
- if(active_spell && active_spell.cast_methods & CAST_MELEE|CAST_RANGED) // If they're trying to melee-cast a spell, use the special animation instead.
+ if(active_spell && active_spell.cast_methods & (CAST_MELEE|CAST_RANGED)) // If they're trying to melee-cast a spell, use the special animation instead.
special_pre_animation(A)
return
diff --git a/code/modules/xenobio/items/slimepotions.dm b/code/modules/xenobio/items/slimepotions.dm
index d0af937114..61fc102d40 100644
--- a/code/modules/xenobio/items/slimepotions.dm
+++ b/code/modules/xenobio/items/slimepotions.dm
@@ -102,7 +102,7 @@
// Simple Mobs.
else if(isanimal(M))
var/mob/living/simple_mob/SM = M
- if(!(SM.mob_class & MOB_CLASS_SLIME|MOB_CLASS_ANIMAL)) // So you can't use this on Russians/syndies/hivebots/etc.
+ if(!(SM.mob_class & (MOB_CLASS_SLIME|MOB_CLASS_ANIMAL))) // So you can't use this on Russians/syndies/hivebots/etc.
to_chat(user, span_warning("\The [SM] only works on slimes and animals."))
return ..()
if(!AI.hostile)
@@ -189,7 +189,7 @@
if(!istype(M))
to_chat(user, span_warning("The agent only works on creatures!"))
return ..()
- if(!(M.mob_class & MOB_CLASS_SLIME|MOB_CLASS_ANIMAL)) // So you can't use this on Russians/syndies/hivebots/etc.
+ if(!(M.mob_class & (MOB_CLASS_SLIME|MOB_CLASS_ANIMAL))) // So you can't use this on Russians/syndies/hivebots/etc.
to_chat(user, span_warning("\The [M] only works on slimes and animals."))
return ..()
if(M.stat == DEAD)
@@ -224,7 +224,7 @@
if(!istype(M))
to_chat(user, span_warning("The agent only works on creatures!"))
return ..()
- if(!(M.mob_class & MOB_CLASS_SLIME|MOB_CLASS_ANIMAL)) // So you can't use this on Russians/syndies/hivebots/etc.
+ if(!(M.mob_class & (MOB_CLASS_SLIME|MOB_CLASS_ANIMAL))) // So you can't use this on Russians/syndies/hivebots/etc.
to_chat(user, span_warning("\The [M] only works on slimes and animals."))
return ..()
if(M.stat == DEAD)
diff --git a/tools/ci/validate_files.sh b/tools/ci/validate_files.sh
index b3ec44bddb..4bf4b65ef5 100755
--- a/tools/ci/validate_files.sh
+++ b/tools/ci/validate_files.sh
@@ -25,7 +25,7 @@ if command -v rg >/dev/null 2>&1; then
map_files="maps/**/**.dmm"
modular_map_files="modular_chomp/maps/**/**.dmm" # CHOMPEdit - Modular maps
# shuttle_map_files="_maps/shuttles/**.dmm"
- # code_x_515="code/**/!(__byond_version_compat).dm"
+ code_x_515="code/**/!(__byond_version_compat).dm"
else
pcre2_support=0
grep=grep
@@ -33,7 +33,7 @@ else
map_files="-r --include=maps/**/**.dmm"
modular_map_files="-r --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"
+ code_x_515="-r --include=code/**/!(__byond_version_compat).dm"
fi
echo -e "${BLUE}Using grep provider at $(which $grep)${NC}"
@@ -57,26 +57,24 @@ part "step_[xy]"
(! $grep 'step_[xy]' $map_files)
retVal=$?
if [ $retVal -ne 0 ]; then
- echo -e "${RED}The variables 'step_x' and 'step_y' are present on a map, and they 'break' movement ingame.${NC}"
- FAILED=1
+ echo -e "${RED}The variables 'step_x' and 'step_y' are present on a map, and they 'break' movement ingame.${NC}"
+ FAILED=1
fi
-# ChompEDIT START
-(! $grep 'step_[xy]' $modular_map_files)
-retVal=$?
-if [ $retVal -ne 0 ]; then
- echo -e "${RED}The variables 'step_x' and 'step_y' are present on a map, and they 'break' movement ingame.${NC}"
- FAILED=1
-fi
-# ChompEDIT END
+part "base /turf usage"
+if grep -P '\W\/turf\s*[,\){]' $map_files; then
+ echo
+ echo -e "${RED}ERROR: base /turf path use detected in maps, please replace with proper paths.${NC}"
+ FAILED=1
+fi;
part "test map included"
#Checking for any 'checked' maps that include 'test'
(! $grep 'maps\\.*test.*' *.dme)
retVal=$?
if [ $retVal -ne 0 ]; then
- echo -e "${RED}A map containing the word 'test' is included. This is not allowed to be committed.${NC}"
- FAILED=1
+ echo -e "${RED}A map containing the word 'test' is included. This is not allowed to be committed.${NC}"
+ FAILED=1
fi
section "code issues"
@@ -87,8 +85,8 @@ echo -e "${RED}DISABLED"
# awk -f tools/indentation.awk $code_files
# retVal=$?
# if [ $retVal -ne 0 ]; then
-# echo -e "${RED}Indention testing failed. Please see results and fix indentation.${NC}"
-# FAILED=1
+# echo -e "${RED}Indention testing failed. Please see results and fix indentation.${NC}"
+# FAILED=1
# fi
part "improperly pathed static lists"
@@ -103,8 +101,8 @@ part "changelog"
md5sum -c - <<< "0c56937110d88f750a32d9075ddaab8b *html/changelogs_ch/example.yml" # CHOMPedit - Better changelogs
retVal=$?
if [ $retVal -ne 0 ]; then
- echo -e "${RED}Do not modify the example.yml changelog file.${NC}"
- FAILED=1
+ echo -e "${RED}Do not modify the example.yml changelog file.${NC}"
+ FAILED=1
fi
part "color macros"
@@ -112,28 +110,49 @@ part "color macros"
(num=`$grep -n '\\\\(red|blue|green|black|b|i[^mnct])' $code_files | wc -l`; echo "$num escapes (expecting ${MACRO_COUNT} or less)"; [ $num -le ${MACRO_COUNT} ]) # CHOMPEdit, we alos need to ignore item paths
retVal=$?
if [ $retVal -ne 0 ]; then
- echo -e "${RED}Do not use any byond color macros (such as \blue), they are deprecated.${NC}"
- FAILED=1
+ echo -e "${RED}Do not use any byond color macros (such as \blue), they are deprecated.${NC}"
+ FAILED=1
fi
+part "typescript react files"
+if ls -1 tgui/**/*.jsx 2>/dev/null; then
+ echo
+ echo -e "${RED}ERROR: JSX file(s) detected, these must be converted to typescript (TSX).${NC}"
+ FAILED=1
+fi;
+
part "balloon_alert sanity"
if $grep 'balloon_alert\(".*"\)' $code_files; then
- echo
- echo -e "${RED}ERROR: Found a balloon alert with improper arguments.${NC}"
- FAILED=1
+ echo
+ echo -e "${RED}ERROR: Found a balloon alert with improper arguments.${NC}"
+ FAILED=1
fi;
if $grep 'balloon_alert(.*span_)' $code_files; then
- echo
- echo -e "${RED}ERROR: Balloon alerts should never contain spans.${NC}"
- FAILED=1
+ echo
+ echo -e "${RED}ERROR: Balloon alerts should never contain spans.${NC}"
+ FAILED=1
fi;
part "balloon_alert idiomatic usage"
if $grep 'balloon_alert\(.*?, ?"[A-Z]' $code_files; then
- echo
- echo -e "${RED}ERROR: Balloon alerts should not start with capital letters. This includes text like 'AI'. If this is a false positive, wrap the text in UNLINT().${NC}"
- FAILED=1
+ echo
+ echo -e "${RED}ERROR: Balloon alerts should not start with capital letters. This includes text like 'AI'. If this is a false positive, wrap the text in UNLINT().${NC}"
+ 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;
part "html tag matching"
@@ -141,8 +160,8 @@ part "html tag matching"
python tools/TagMatcher/tag-matcher.py ../..
retVal=$?
if [ $retVal -ne 0 ]; then
- echo -e "${RED}Some HTML tags are missing their opening/closing partners. Please correct this.${NC}"
- FAILED=1
+ echo -e "${RED}Some HTML tags are missing their opening/closing partners. Please correct this.${NC}"
+ FAILED=1
fi
if [ "$pcre2_support" -eq 1 ]; then
@@ -222,11 +241,11 @@ else
fi
if [ $FAILED = 0 ]; then
- echo
- echo -e "${GREEN}No errors found using $grep!${NC}"
+ echo
+ echo -e "${GREEN}No errors found using $grep!${NC}"
else
- echo
- echo -e "${RED}Errors found, please fix them and try again.${NC}"
+ echo
+ echo -e "${RED}Errors found, please fix them and try again.${NC}"
fi
# Quit with our status code