mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 23:27:34 +01:00
Wraps lowertext() to ensure proper stringification. (#82442)
## About The Pull Request Fixes #82440 This PR just creates a new macro, `LOWER_TEXT()` (yes the irony is not lost on me) to wrap around all calls of `lowertext()` and ensure that whatever we input into that proc will be stringified using the `"[]"` (or `tostring()` for the nerds) operator. very simple. I also added a linter to enforce this (and prevent all forms of regression) because I think that machines should do the menial work and we shouldn't expect maintainers to remember this, let me know if you disagree. if there is a time when it should be opted out for some reason, the linter does respect it if you wrap your input with the `UNLINT()` function.
This commit is contained in:
@@ -154,13 +154,13 @@
|
||||
|
||||
if("recolor")
|
||||
var/index = text2num(params["color_index"])
|
||||
var/new_color = lowertext(params["new_color"])
|
||||
var/new_color = LOWER_TEXT(params["new_color"])
|
||||
if(split_colors[index] != new_color && (findtext(new_color, GLOB.is_color) || (unlocked && findtext(new_color, GLOB.is_alpha_color))))
|
||||
split_colors[index] = new_color
|
||||
queue_refresh()
|
||||
|
||||
if("recolor_from_string")
|
||||
var/full_color_string = lowertext(params["color_string"])
|
||||
var/full_color_string = LOWER_TEXT(params["color_string"])
|
||||
if(full_color_string != split_colors.Join() && ReadColorsFromString(full_color_string))
|
||||
queue_refresh()
|
||||
|
||||
|
||||
@@ -577,7 +577,7 @@
|
||||
duration = text2num(duration)
|
||||
if (!(interval in list("SECOND", "MINUTE", "HOUR", "DAY", "WEEK", "MONTH", "YEAR")))
|
||||
interval = "MINUTE"
|
||||
var/time_message = "[duration] [lowertext(interval)]" //no DisplayTimeText because our duration is of variable interval type
|
||||
var/time_message = "[duration] [LOWER_TEXT(interval)]" //no DisplayTimeText because our duration is of variable interval type
|
||||
if(duration > 1) //pluralize the interval if necessary
|
||||
time_message += "s"
|
||||
var/is_server_ban = (roles_to_ban[1] == "Server")
|
||||
|
||||
@@ -1027,7 +1027,7 @@ GLOBAL_DATUM_INIT(sdql2_vv_statobj, /obj/effect/statclick/sdql2_vv_all, new(null
|
||||
return null
|
||||
|
||||
else if(expression [start] == "{" && long)
|
||||
if(lowertext(copytext(expression[start + 1], 1, 3)) != "0x") //3 == length("0x") + 1
|
||||
if(LOWER_TEXT(copytext(expression[start + 1], 1, 3)) != "0x") //3 == length("0x") + 1
|
||||
to_chat(usr, span_danger("Invalid pointer syntax: [expression[start + 1]]"), confidential = TRUE)
|
||||
return null
|
||||
var/datum/located = locate("\[[expression[start + 1]]]")
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
return null
|
||||
|
||||
/datum/sdql_parser/proc/tokenl(i)
|
||||
return lowertext(token(i))
|
||||
return LOWER_TEXT(token(i))
|
||||
|
||||
/datum/sdql_parser/proc/query_options(i, list/node)
|
||||
var/list/options = list()
|
||||
@@ -624,7 +624,7 @@
|
||||
node += "null"
|
||||
i++
|
||||
|
||||
else if(lowertext(copytext(token(i), 1, 3)) == "0x" && isnum(hex2num(copytext(token(i), 3))))//3 == length("0x") + 1
|
||||
else if(LOWER_TEXT(copytext(token(i), 1, 3)) == "0x" && isnum(hex2num(copytext(token(i), 3))))//3 == length("0x") + 1
|
||||
node += hex2num(copytext(token(i), 3))
|
||||
i++
|
||||
|
||||
|
||||
@@ -81,8 +81,8 @@
|
||||
/proc/_log(X, Y)
|
||||
return log(X, Y)
|
||||
|
||||
/proc/_lowertext(T)
|
||||
return lowertext(T)
|
||||
/proc/_LOWER_TEXT(T)
|
||||
return LOWER_TEXT(T)
|
||||
|
||||
/proc/_matrix(a, b, c, d, e, f)
|
||||
return matrix(a, b, c, d, e, f)
|
||||
|
||||
@@ -222,7 +222,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
|
||||
|
||||
if(record_found)//If they have a record we can determine a few things.
|
||||
new_character.real_name = record_found.name
|
||||
new_character.gender = lowertext(record_found.gender)
|
||||
new_character.gender = LOWER_TEXT(record_found.gender)
|
||||
new_character.age = record_found.age
|
||||
var/datum/dna/found_dna = record_found.locked_dna
|
||||
new_character.hardset_dna(found_dna.unique_identity, found_dna.mutation_index, null, record_found.name, record_found.blood_type, new record_found.species_type, found_dna.features)
|
||||
|
||||
@@ -1047,10 +1047,10 @@ GLOBAL_DATUM_INIT(admin_help_ui_handler, /datum/admin_help_ui_handler, new)
|
||||
if(!M.mind)
|
||||
continue
|
||||
|
||||
for(var/string in splittext(lowertext(M.real_name), " "))
|
||||
for(var/string in splittext(LOWER_TEXT(M.real_name), " "))
|
||||
if(!(string in ignored_words))
|
||||
nameWords += string
|
||||
for(var/string in splittext(lowertext(M.name), " "))
|
||||
for(var/string in splittext(LOWER_TEXT(M.name), " "))
|
||||
if(!(string in ignored_words))
|
||||
nameWords += string
|
||||
|
||||
|
||||
@@ -629,7 +629,7 @@
|
||||
// The ticket's id
|
||||
var/ticket_id = ticket?.id
|
||||
|
||||
var/compliant_msg = trim(lowertext(message))
|
||||
var/compliant_msg = trim(LOWER_TEXT(message))
|
||||
var/tgs_tagged = "[sender](TGS/External)"
|
||||
var/list/splits = splittext(compliant_msg, " ")
|
||||
var/split_size = length(splits)
|
||||
|
||||
@@ -34,7 +34,7 @@ GLOBAL_PROTECT(player_ticket_history)
|
||||
var/list/user_selections = list()
|
||||
|
||||
/datum/ticket_history_holder/proc/cache_history_for_ckey(ckey, entries = 5)
|
||||
ckey = lowertext(ckey)
|
||||
ckey = LOWER_TEXT(ckey)
|
||||
|
||||
if(!isnum(entries) || entries <= 0)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user