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)
| 914 | |
| 915 | |
| 916 | def _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 | |
| 929 | def _is_banner_payload(payload: str) -> bool: |
no test coverage detected