(scan: sqlite3.Row)
| 970 | |
| 971 | |
| 972 | def scan_contract(scan: sqlite3.Row) -> dict[str, Any]: |
| 973 | target = Path(scan["target_path"]) |
| 974 | target_contract = { |
| 975 | "allowedKinds": expected_target_kinds(scan), |
| 976 | "displayName": target.name, |
| 977 | "targetId": stable_target_id(target), |
| 978 | } |
| 979 | if ( |
| 980 | scan["mode"] != "diff" |
| 981 | and scan["target_snapshot_digest"] |
| 982 | and ( |
| 983 | scan["target_revision"] == "unversioned" |
| 984 | or scan["target_snapshot_digest"] != clean_worktree_content_digest() |
| 985 | ) |
| 986 | ): |
| 987 | target_contract["requiredSnapshotDigest"] = scan["target_snapshot_digest"] |
| 988 | return { |
| 989 | "diffTarget": stored_diff_target(scan), |
| 990 | "scope": { |
| 991 | "requiredExcludePaths": [], |
| 992 | "requestedPath": scan["scope"], |
| 993 | **({"requiredIncludePaths": [scan["scope"]]} if scan["mode"] != "diff" else {}), |
| 994 | }, |
| 995 | "target": target_contract, |
| 996 | } |
| 997 | |
| 998 | |
| 999 | def expected_coverage_mode(scan: sqlite3.Row) -> str: |
no test coverage detected