Test that rule descriptions are properly formatted.
()
| 224 | |
| 225 | |
| 226 | def test_sarif_rule_descriptions(): |
| 227 | """Test that rule descriptions are properly formatted.""" |
| 228 | sarif = run_sarif_check(TEST_CODE) |
| 229 | |
| 230 | run = sarif["runs"][0] |
| 231 | driver = run["tool"]["driver"] |
| 232 | rules = driver["rules"] |
| 233 | |
| 234 | assert len(rules) > 0 |
| 235 | |
| 236 | for rule in rules: |
| 237 | # Each rule should have required fields |
| 238 | assert "id" in rule |
| 239 | assert "name" in rule |
| 240 | assert "shortDescription" in rule |
| 241 | assert "fullDescription" in rule |
| 242 | |
| 243 | # Descriptions should be empty (allowing GitHub to use instance messages) |
| 244 | assert rule["name"] == "" |
| 245 | assert rule["shortDescription"]["text"] == "" |
| 246 | assert rule["fullDescription"]["text"] == "" |
| 247 | |
| 248 | # Should have properties |
| 249 | assert "properties" in rule |
| 250 | |
| 251 | |
| 252 | def test_sarif_cwe_tags(): |
nothing calls this directly
no test coverage detected