fold/tests/benchmarks/source/code_quality_structural.json
trvon b0b51f1e71
feat: converge quality and scan interfaces
- fail closed on MCP input and compile database policy
- add shared scan catalogs, finding queries, and tiered gates
2026-07-29 00:57:33 -04:00

90 lines
3.2 KiB
JSON

{
"schema_version": 1,
"case_id": "source-code-quality-structural",
"case_type": "finding-set",
"origin": "synthetic",
"backend": "source",
"name": "source_code_quality_structural",
"description": "Structural-quality golden covering duplicate functions/classes, semantic equivalence, complexity, dead statements, and unused internal helpers with clean near misses.",
"sources": [
"../../fixtures/quality/structural_debt.cpp",
"../../fixtures/quality/structural_clean.cpp"
],
"detectors": "clone,equiv,class-dup,complexity,dead-statement,unused-function",
"processes": 1,
"scan_args": [
"--complexity-threshold",
"5",
"--min-body-stmts",
"2"
],
"expect": {
"require_physical_location": true,
"require_backend": true,
"budgets": {
"max_wall_seconds": 8.0,
"max_cpu_seconds": 12.0,
"max_rss_mb": 1024
},
"coverage_requirements": {
"fold.clone": ["positive", "negative", "regression"],
"fold.equiv": ["positive", "negative", "regression"],
"fold.duplicate-class": ["positive", "negative", "regression"],
"fold.high-complexity": ["positive", "negative", "regression"],
"fold.dead-statement": ["positive", "negative", "regression"],
"fold.unused-function": ["positive", "negative", "regression"]
},
"must_report": [
{
"ruleId": "fold.clone",
"backend": "source",
"coverage": ["positive", "regression"],
"messageRegex": "normalizedTotalA.*normalizedTotalB"
},
{
"ruleId": "fold.equiv",
"backend": "source",
"coverage": ["positive", "regression"],
"messageRegex": "normalizedTotalA.*normalizedTotalB"
},
{
"ruleId": "fold.duplicate-class",
"backend": "source",
"coverage": ["positive", "regression"],
"messageRegex": "CounterA.*CounterB"
},
{
"ruleId": "fold.high-complexity",
"backend": "source",
"coverage": ["positive", "regression"],
"messageRegex": "branchHeavy"
},
{
"ruleId": "fold.dead-statement",
"backend": "source",
"coverage": ["positive", "regression"],
"functionRegex": "returnsBeforeCleanup"
},
{
"ruleId": "fold.unused-function",
"backend": "source",
"coverage": ["positive", "regression"],
"messageRegex": "orphanedHelper"
}
],
"must_not_report": [
{"ruleId": "fold.clone", "uriRegex": "structural_clean\\.cpp", "coverage": "negative"},
{"ruleId": "fold.equiv", "uriRegex": "structural_clean\\.cpp", "coverage": "negative"},
{"ruleId": "fold.duplicate-class", "uriRegex": "structural_clean\\.cpp", "coverage": "negative"},
{"ruleId": "fold.high-complexity", "uriRegex": "structural_clean\\.cpp", "coverage": "negative"},
{"ruleId": "fold.dead-statement", "uriRegex": "structural_clean\\.cpp", "coverage": "negative"},
{"ruleId": "fold.unused-function", "uriRegex": "structural_clean\\.cpp", "coverage": "negative"},
{
"messageRegex": "boundedIncrement|useHelper|structural_clean::Reader|structural_clean::Writer"
},
{
"uriRegex": "structural_clean\\.cpp"
}
]
}
}