mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 19:47:22 +01:00
fixes a to_chat runtime, lints now throw an error if a to_chat proc lacks a target argument (#21827)
* untested :) * i may be stupid * there we go
This commit is contained in:
@@ -313,7 +313,7 @@
|
||||
if(stat & BROKEN)
|
||||
return
|
||||
if(!anchored)
|
||||
to_chat("<span class='warning'>[src] must be anchored first!</span>")
|
||||
to_chat(user, "<span class='warning'>[src] must be anchored first!</span>")
|
||||
return
|
||||
ui_interact(user)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ IGNORE_515_PROC_MARKER_FILENAME = "__byond_version_compat.dm"
|
||||
CHECK_515_PROC_MARKER_RE = re.compile(r"\.proc/")
|
||||
def check_515_proc_syntax(lines):
|
||||
for idx, line in enumerate(lines):
|
||||
if CHECK_515_PROC_MARKER_RE.match(line):
|
||||
if CHECK_515_PROC_MARKER_RE.search(line):
|
||||
return Failure(idx + 1, "Outdated proc reference use detected in code. Please use proc reference helpers.")
|
||||
|
||||
|
||||
@@ -89,6 +89,11 @@ def check_proc_args_with_var_prefix(lines):
|
||||
if PROC_ARGS_WITH_VAR_PREFIX_RE.match(line):
|
||||
return Failure(idx + 1, "Changed files contains a proc argument starting with 'var'.")
|
||||
|
||||
TO_CHAT_WITH_NO_USER_ARG_RE = re.compile(r"to_chat\(\"")
|
||||
def check_to_chats_have_a_user_arguement(lines):
|
||||
for idx, line in enumerate(lines):
|
||||
if TO_CHAT_WITH_NO_USER_ARG_RE.search(line):
|
||||
return Failure(idx + 1, "Changed files contains a to_chat() procedure without a user argument.")
|
||||
|
||||
CODE_CHECKS = [
|
||||
check_space_indentation,
|
||||
@@ -96,6 +101,7 @@ CODE_CHECKS = [
|
||||
check_trailing_newlines,
|
||||
check_global_vars,
|
||||
check_proc_args_with_var_prefix,
|
||||
check_to_chats_have_a_user_arguement,
|
||||
]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user