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

Function _compute_fence_mask

scripts/code-verify.py:882–899  ·  view source on GitHub ↗

Return a per-line bitmap; True means the line sits inside a `// code-format off` / `// code-format on` fence and must be skipped by every rule. The fence lines themselves are masked too so they don't get flagged as multi-line comment runs.

(lines: list[str])

Source from the content-addressed store, hash-verified

880
881
882def _compute_fence_mask(lines: list[str]) -> list[bool]:
883 """Return a per-line bitmap; True means the line sits inside a
884 `// code-format off` / `// code-format on` fence and must be skipped by
885 every rule. The fence lines themselves are masked too so they don't get
886 flagged as multi-line comment runs."""
887 mask = [False] * len(lines)
888 fenced = False
889 for i, line in enumerate(lines):
890 if _FENCE_OFF_RE.match(line):
891 fenced = True
892 mask[i] = True
893 continue
894 if _FENCE_ON_RE.match(line):
895 fenced = False
896 mask[i] = True
897 continue
898 mask[i] = fenced
899 return mask
900
901
902def _is_line_comment(line: str) -> bool:

Callers 1

process_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected