Extract the linter JSON array from soldr/cargo captured stdout.
(stdout: str | None)
| 139 | |
| 140 | |
| 141 | def parse_rust_json_output(stdout: str | None) -> list[dict[str, Any]]: |
| 142 | """Extract the linter JSON array from soldr/cargo captured stdout.""" |
| 143 | text = stdout or "[]" |
| 144 | decoder = json.JSONDecoder() |
| 145 | |
| 146 | for index, char in enumerate(text): |
| 147 | if char != "[": |
| 148 | continue |
| 149 | try: |
| 150 | value, _end = decoder.raw_decode(text[index:]) |
| 151 | except json.JSONDecodeError: |
| 152 | continue |
| 153 | if isinstance(value, list): |
| 154 | return value |
| 155 | |
| 156 | raise RuntimeError("Rust C++ linter did not produce valid JSON on stdout") |
| 157 | |
| 158 | |
| 159 | def run_rust_ab_check( |
no outgoing calls