Stop the trailing-log check reading a longer function name as a call

The "if ... <fn> ; then" pattern let its \S* end inside another name,
so `if text=$(read_gateway_log ...); then` counted as a status-testing
call of every function named `log`, and two test harnesses' log helpers
were flagged for callers they do not have. The name must now start at an
identifier boundary.
This commit is contained in:
Johnathan Corgan
2026-09-27 19:35:48 +00:00
parent 6b17d6ee00
commit 8d9c5268ce
+3 -1
View File
@@ -132,7 +132,9 @@ def status_tested(name: str, all_text: str, defining_file: Path) -> list[str]:
(rf"^\s*{re.escape(name)}\s*\|\|", "<fn> ||"), (rf"^\s*{re.escape(name)}\s*\|\|", "<fn> ||"),
(rf"^\s*{re.escape(name)}\s+[^\n|&]*&&", "<fn> &&"), (rf"^\s*{re.escape(name)}\s+[^\n|&]*&&", "<fn> &&"),
(rf"^\s*{re.escape(name)}\s*&&", "<fn> &&"), (rf"^\s*{re.escape(name)}\s*&&", "<fn> &&"),
(rf"\bif\s+\S*\s*{re.escape(name)}\b.*;\s*then", "if ... <fn> ; then"), # The lookbehind keeps `\S*` from ending inside a longer name, so
# `if text=$(read_gateway_log ...); then` is not read as a call of `log`.
(rf"\bif\s+\S*\s*(?<![A-Za-z0-9_]){re.escape(name)}\b.*;\s*then", "if ... <fn> ; then"),
# Command substitution. Found 2026-07-23 while fixing a function this # Command substitution. Found 2026-07-23 while fixing a function this
# check reported clean: `total=$(count_log_pattern "$p") || { ... }` # check reported clean: `total=$(count_log_pattern "$p") || { ... }`
# consumes the status, but the line begins with the variable, so none # consumes the status, but the line begins with the variable, so none