Test that rules have required properties.
()
| 428 | |
| 429 | |
| 430 | def test_sarif_rule_properties(): |
| 431 | """Test that rules have required properties.""" |
| 432 | sarif = run_sarif_check(TEST_CODE) |
| 433 | |
| 434 | run = sarif["runs"][0] |
| 435 | driver = run["tool"]["driver"] |
| 436 | rules = driver["rules"] |
| 437 | |
| 438 | for rule in rules: |
| 439 | assert "properties" in rule |
| 440 | props = rule["properties"] |
| 441 | |
| 442 | # Required properties |
| 443 | assert "precision" in props |
| 444 | assert props["precision"] in ["very-high", "high", "medium", "low"] |
| 445 | |
| 446 | assert "problem.severity" in props |
| 447 | assert props["problem.severity"] in [ |
| 448 | "error", |
| 449 | "warning", |
| 450 | "style", |
| 451 | "performance", |
| 452 | "portability", |
| 453 | "information", |
| 454 | "note", |
| 455 | ] |
| 456 | |
| 457 | |
| 458 | def test_sarif_rule_coverage(): |
nothing calls this directly
no test coverage detected