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

Function _is_tooling_pragma

scripts/code-verify.py:916–926  ·  view source on GitHub ↗

True when `line` is a `//` comment that carries a tooling pragma (`// clang-format off/on`, `// NOLINT...`, `// cppcheck-suppress ...`, `// fallthrough`). Pragmas are never prose, so they neither start a multi-line `//` run nor extend one. Treating `// foo` followed by `// clang-for

(line: str)

Source from the content-addressed store, hash-verified

914
915
916def _is_tooling_pragma(line: str) -> bool:
917 """True when `line` is a `//` comment that carries a tooling pragma
918 (`// clang-format off/on`, `// NOLINT...`, `// cppcheck-suppress ...`,
919 `// fallthrough`). Pragmas are never prose, so they neither start a
920 multi-line `//` run nor extend one. Treating `// foo` followed by
921 `// clang-format off` as a 2-line comment block is wrong — the second
922 line is a directive, not narration."""
923 payload = _comment_payload(line)
924 if payload is None:
925 return False
926 return bool(_TOOLING_PRAGMA_RE.match(payload))
927
928
929def _is_banner_payload(payload: str) -> bool:

Calls 1

_comment_payloadFunction · 0.85

Tested by

no test coverage detected