mirror of
https://github.com/jmcorgan/fips.git
synced 2026-10-05 19:18:25 +00:00
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:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user