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

Function cleanup_scan

src/scancode/cli_test_utils.py:287–300  ·  view source on GitHub ↗

Cleanup in place the ``scan_results`` mapping for dates, headers and other variable data that break tests otherwise.

(scan_results, remove_file_date=False)

Source from the content-addressed store, hash-verified

285
286
287def cleanup_scan(scan_results, remove_file_date=False):
288 """
289 Cleanup in place the ``scan_results`` mapping for dates, headers and
290 other variable data that break tests otherwise.
291 """
292 # clean new headers attributes
293 streamline_headers(scan_results.get('headers', []))
294 # clean file_level attributes
295 for scanned_file in scan_results['files']:
296 streamline_scanned_file(scanned_file, remove_file_date)
297
298 # TODO: remove sort, this should no longer be needed
299 scan_results['files'].sort(key=lambda x: x['path'])
300 return scan_results
301
302
303def streamline_errors(errors):

Callers 1

load_yaml_resultsFunction · 0.90

Calls 4

streamline_headersFunction · 0.85
streamline_scanned_fileFunction · 0.85
getMethod · 0.65
sortMethod · 0.45

Tested by

no test coverage detected