Test that SARIF output has the correct basic structure.
()
| 127 | |
| 128 | |
| 129 | def test_sarif_basic_structure(): |
| 130 | """Test that SARIF output has the correct basic structure.""" |
| 131 | sarif = run_sarif_check(BASIC_TEST_CODE) |
| 132 | |
| 133 | # Check required SARIF fields |
| 134 | assert sarif["version"] == "2.1.0" |
| 135 | assert "$schema" in sarif |
| 136 | assert "sarif-schema" in sarif["$schema"] |
| 137 | assert "runs" in sarif |
| 138 | assert len(sarif["runs"]) == 1 |
| 139 | |
| 140 | run = sarif["runs"][0] |
| 141 | assert "tool" in run |
| 142 | assert "results" in run |
| 143 | |
| 144 | tool = run["tool"] |
| 145 | assert "driver" in tool |
| 146 | |
| 147 | driver = tool["driver"] |
| 148 | assert driver["name"] == "Cppcheck" |
| 149 | assert "rules" in driver |
| 150 | assert "semanticVersion" in driver |
| 151 | |
| 152 | |
| 153 | def test_sarif_null_pointer(): |
nothing calls this directly
no test coverage detected