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)
| 1178 | |
| 1179 | |
| 1180 | def _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 | |
| 1200 | def find_ai_narration_violations( |
no outgoing calls
no test coverage detected