Adds lint for assigning variables to themselves (#20744)

* Fixes some funny bugs, adds a lint to check for future

* Proven that the grep works, pushing this fix
This commit is contained in:
adamsong
2023-10-26 21:25:37 -04:00
committed by GitHub
parent bec4acab3e
commit 58f40a32f5
8 changed files with 12 additions and 10 deletions

View File

@@ -555,7 +555,6 @@
for(var/datum/antagonist/A in antag_datums)
objective = locate(href_list["obj_completed"]) in A.objectives
if(istype(objective))
objective = objective
break
if(!objective)
to_chat(usr,"Invalid objective.")

View File

@@ -187,8 +187,6 @@
else if(limb.body_zone in list(BODY_ZONE_L_ARM, BODY_ZONE_R_ARM))
if(limb.current_gauze)
interaction_efficiency_penalty = 1 + ((interaction_efficiency_penalty - 1) * limb.current_gauze.splint_factor)
else
interaction_efficiency_penalty = interaction_efficiency_penalty
if(initial(disabling))
set_disabling(!limb.current_gauze)

View File

@@ -204,7 +204,7 @@ GLOBAL_LIST_EMPTY(objectives)
/datum/objective/proc/copy_target(datum/objective/old_obj)
target = old_obj.get_target()
target_amount = old_obj.target_amount
explanation_text = explanation_text
explanation_text = old_obj.explanation_text
/datum/objective/assassinate
name = "assassinate"

View File

@@ -175,7 +175,7 @@ GLOBAL_LIST_INIT(freqtospan, list(
INITIALIZE_IMMEDIATE(/atom/movable/virtualspeaker)
/atom/movable/virtualspeaker/Initialize(mapload, atom/movable/M, radio)
. = ..()
radio = radio
src.radio = radio
source = M
if (istype(M))
name = M.GetVoice()

View File

@@ -310,7 +310,6 @@
if(!new_severity)
qdel(query_find_edit_note_severity)
return
new_severity = new_severity
var/edit_text = "Note severity edited by [editor_key] on [SQLtime()] from [old_severity] to [new_severity]<hr>"
var/datum/DBQuery/query_edit_note_severity = SSdbcore.NewQuery({"
UPDATE [format_table_name("messages")]

View File

@@ -477,9 +477,11 @@
// And these 3 lines prevent it from happening while being quiet.
// So.. it works.
// Don't touch it.
var/whatthefuck = i
whatthefuck = src.type
whatthefuck = whatthefuck
// Looks like the bug got fixed, it works commented out now
// If it breaks again, try uncommenting
// var/whatthefuck = i
// whatthefuck = src.type
// whatthefuck = whatthefuck
while(token(i) && token(i) != "]")

View File

@@ -154,7 +154,7 @@
var/obj/effect/dummy/phased_mob/holder = new /obj/effect/dummy/phased_mob(loc)
extinguish_mob()
forceMove(holder)
holder = holder
src.holder = holder
notransform = FALSE
fakefireextinguish()

View File

@@ -63,6 +63,10 @@ if grep -P '^/(obj|mob|turf|area|atom)/.+/Initialize\((?!mapload).*\)' code/**/*
echo "ERROR: Initialize override without 'mapload' argument."
st=1
fi;
if grep -P '^\s*(\w+)\s*=\s*(\1)\b\s*$' code/**/*.dm; then
echo "ERROR: Variable is assigned to itself"
st=1
fi;
for json in _maps/*.json
do
filename="_maps/$(jq -r '.map_path' $json)/$(jq -r '.map_file' $json)"