MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / test_sarif_rule_descriptions

Function test_sarif_rule_descriptions

test/cli/sarif_test.py:226–249  ·  view source on GitHub ↗

Test that rule descriptions are properly formatted.

()

Source from the content-addressed store, hash-verified

224
225
226def 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
252def test_sarif_cwe_tags():

Callers

nothing calls this directly

Calls 1

run_sarif_checkFunction · 0.85

Tested by

no test coverage detected