mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-18 20:49:28 +00:00
feat(three-stage-scan): report map and honor fail-on worth-fixing
This commit is contained in:
@@ -7,6 +7,7 @@ from .ledger import (
|
||||
hotspot_key,
|
||||
load_ledger,
|
||||
must_keep_as_candidate,
|
||||
persist_verdicts,
|
||||
record_verdict,
|
||||
select_forced_candidates,
|
||||
write_ledger,
|
||||
@@ -27,6 +28,7 @@ __all__ = [
|
||||
"hotspot_key",
|
||||
"load_ledger",
|
||||
"must_keep_as_candidate",
|
||||
"persist_verdicts",
|
||||
"record_verdict",
|
||||
"select_forced_candidates",
|
||||
"write_complexity_map",
|
||||
|
||||
@@ -35,6 +35,7 @@ class TestHint:
|
||||
gap: str # no_adjacent_test | no_function_reference | no_fuzz_entry | covered
|
||||
test_kind: str | None
|
||||
reason: str
|
||||
__test__ = False
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
if self.gap not in GAPS:
|
||||
|
||||
@@ -57,6 +57,27 @@ def write_ledger(path: Path, ledger: Mapping[str, LedgerEntry | Mapping[str, obj
|
||||
path.write_text(json.dumps(payload, indent=2, sort_keys=True) + "\n")
|
||||
|
||||
|
||||
def persist_verdicts(path: Path, verdicts: Sequence[object]) -> dict[str, LedgerEntry]:
|
||||
"""Record triggerable / not_triggerable outcomes into the loop-owned complexity ledger."""
|
||||
ledger = load_ledger(path)
|
||||
changed = False
|
||||
for item in verdicts:
|
||||
verdict = str(getattr(item, "verdict", ""))
|
||||
if verdict not in VERDICT_DELTAS:
|
||||
continue
|
||||
raw_function = getattr(item, "function_name", None)
|
||||
ledger = record_verdict(
|
||||
ledger,
|
||||
path=str(getattr(item, "path", "")),
|
||||
function_name=raw_function if isinstance(raw_function, str) else None,
|
||||
verdict=verdict,
|
||||
)
|
||||
changed = True
|
||||
if changed:
|
||||
write_ledger(path, ledger)
|
||||
return ledger
|
||||
|
||||
|
||||
def record_verdict(
|
||||
ledger: Mapping[str, LedgerEntry | Mapping[str, object]],
|
||||
*,
|
||||
|
||||
Reference in New Issue
Block a user