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:
GDN
2023-09-01 16:39:21 -05:00
committed by GitHub
parent df7c7fba0a
commit 100a9d18b6
2 changed files with 8 additions and 2 deletions

View File

@@ -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,
]