( rawInfo: Model<HeaderAttributes, HeaderAttributes> )
| 56 | } |
| 57 | |
| 58 | export function parseScanInfo( |
| 59 | rawInfo: Model<HeaderAttributes, HeaderAttributes> |
| 60 | ): ScanInfo { |
| 61 | const optionsList = |
| 62 | Object.entries(parseIfValidJson(rawInfo.getDataValue("options")) || []) || |
| 63 | []; |
| 64 | const optionsMap = new Map<ScanOptionKeys, unknown>( |
| 65 | optionsList.map(([k, v]) => [k as ScanOptionKeys, v]) |
| 66 | ); |
| 67 | |
| 68 | const parsedScanInfo: ScanInfo = { |
| 69 | json_file_name: rawInfo.getDataValue("json_file_name") || "Not available", |
| 70 | tool_name: rawInfo.getDataValue("tool_name") || "", |
| 71 | tool_version: rawInfo.getDataValue("tool_version") || "", |
| 72 | notice: rawInfo.getDataValue("notice") || "", |
| 73 | duration: rawInfo.getDataValue("duration") |
| 74 | ? Number(rawInfo.getDataValue("duration")).toFixed(2) |
| 75 | : null, |
| 76 | optionsList, |
| 77 | optionsMap, |
| 78 | input: parseIfValidJson(rawInfo.getDataValue("input")) || [], |
| 79 | files_count: Number(rawInfo.getDataValue("files_count")), |
| 80 | output_format_version: rawInfo.getDataValue("output_format_version") || "", |
| 81 | spdx_license_list_version: |
| 82 | rawInfo.getDataValue("spdx_license_list_version") || "", |
| 83 | operating_system: rawInfo.getDataValue("operating_system") || "", |
| 84 | cpu_architecture: rawInfo.getDataValue("cpu_architecture") || "", |
| 85 | platform: rawInfo.getDataValue("platform") || "", |
| 86 | platform_version: rawInfo.getDataValue("platform_version") || "", |
| 87 | python_version: rawInfo.getDataValue("python_version") || "", |
| 88 | workbench_version: rawInfo.getDataValue("workbench_version") || "", |
| 89 | workbench_notice: rawInfo.getDataValue("workbench_notice") || "", |
| 90 | raw_header_content: rawInfo.getDataValue("header_content") || "", |
| 91 | errors: parseIfValidJson(rawInfo.getDataValue("errors")) || [], |
| 92 | }; |
| 93 | return parsedScanInfo; |
| 94 | } |
no test coverage detected