MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / streamline_jsonlines_scan

Function streamline_jsonlines_scan

src/scancode/cli_test_utils.py:386–399  ·  view source on GitHub ↗

Remove or update variable fields from `scan_result`such as version and errors to ensure that the test data is stable. If `remove_file_date` is True, the file.date attribute is removed.

(scan_result, remove_file_date=False)

Source from the content-addressed store, hash-verified

384
385
386def streamline_jsonlines_scan(scan_result, remove_file_date=False):
387 """
388 Remove or update variable fields from `scan_result`such as version and
389 errors to ensure that the test data is stable.
390
391 If `remove_file_date` is True, the file.date attribute is removed.
392 """
393 for result_line in scan_result:
394 headers = result_line.get('headers', {})
395 if headers:
396 streamline_headers(headers)
397
398 for scanned_file in result_line.get('files', []):
399 streamline_scanned_file(scanned_file, remove_file_date)
400
401
402def check_json(expected, results, regen=REGEN_TEST_FIXTURES):

Callers 1

check_jsonlines_scanFunction · 0.85

Calls 3

streamline_headersFunction · 0.85
streamline_scanned_fileFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected