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:
san7890
2024-04-10 12:19:43 -07:00
committed by GitHub
parent a8ea2910c9
commit c403a6eccc
98 changed files with 175 additions and 161 deletions
+1 -1
View File
@@ -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)