MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / _comment_payload

Function _comment_payload

scripts/code-verify.py:1180–1197  ·  view source on GitHub ↗

Return the text after `//`/`///`/`//!` markers on a `//` comment line, or None when the line isn't a single-line comment. Leading/trailing whitespace is preserved on the payload so anchored patterns still see the start of the prose.

(line: str)

Source from the content-addressed store, hash-verified

1178
1179
1180def _comment_payload(line: str) -> str | None:
1181 """Return the text after `//`/`///`/`//!` markers on a `//` comment line,
1182 or None when the line isn't a single-line comment. Leading/trailing
1183 whitespace is preserved on the payload so anchored patterns still see
1184 the start of the prose."""
1185 stripped = line.lstrip()
1186 if not stripped.startswith("//"):
1187 return None
1188 # Strip up to three slashes plus an optional `!` (`///`, `//!`, `///!`)
1189 # then a single space if present.
1190 j = 2
1191 while j < len(stripped) and stripped[j] == "/":
1192 j += 1
1193 if j < len(stripped) and stripped[j] == "!":
1194 j += 1
1195 if j < len(stripped) and stripped[j] == " ":
1196 j += 1
1197 return stripped[j:]
1198
1199
1200def find_ai_narration_violations(

Callers 4

_is_tooling_pragmaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected