From b90b8e87b7d3a54a29b6b05210cec6d4e8887101 Mon Sep 17 00:00:00 2001 From: jperezde Date: Mon, 18 Mar 2024 02:01:12 -0700 Subject: [PATCH] snyk: skip writing of scan metadata when no supported project Reproducer: csmock -r rhel-9-x86_64 -t snyk -f octavia-amphora-image-vert-fips-x86_64-18.0-20240305.1.el9ost.src.rpm Related: https://issues.redhat.com/browse/OSH-583 When an snyk-unsupported project is scanned using snyk, no stats are generated. --- py/plugins/snyk.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/py/plugins/snyk.py b/py/plugins/snyk.py index 54ca728..c421f47 100644 --- a/py/plugins/snyk.py +++ b/py/plugins/snyk.py @@ -184,8 +184,9 @@ def scan_hook(results, mock, props): if ec == 3: # If there are no supported project, we return no results but no crash. results.print_with_ts("snyk-code: no supported project for Snyk") - # If no supported project, no results file is generated + # If no supported project, no results file is generated and no stats are generated props.copy_out_files.remove(SNYK_OUTPUT) + props.post_process_hooks.remove(write_snyk_stats_metadata) return 0 if ec not in [0, 1]: results.error("snyk code returned unexpected exit status: %d" % ec, ec=ec)