Load the JSON scan results file at `location` location as UTF-8 JSON. To help with test resilience against small changes some attributes are removed or streamlined such as the "tool_version" and scan "errors". To optionally also remove date attributes from "files" and "headers"
(location, remove_file_date=False)
| 254 | |
| 255 | |
| 256 | def load_json_result(location, remove_file_date=False): |
| 257 | """ |
| 258 | Load the JSON scan results file at `location` location as UTF-8 JSON. |
| 259 | |
| 260 | To help with test resilience against small changes some attributes are |
| 261 | removed or streamlined such as the "tool_version" and scan "errors". |
| 262 | |
| 263 | To optionally also remove date attributes from "files" and "headers" |
| 264 | entries, set the `remove_file_date` argument to True. |
| 265 | """ |
| 266 | with io.open(location, encoding='utf-8') as res: |
| 267 | scan_results = res.read() |
| 268 | return load_json_result_from_string(scan_results, remove_file_date) |
| 269 | |
| 270 | |
| 271 | def load_json_result_from_string(string, remove_file_date=False): |
no test coverage detected