Repository: bridgecrewio/checkov

Issue:
Improve handling of missing dependencies for helm and kustomize
**Describe the issue**
If you run with `--framework helm`, you get an `INFO` log message that the framework was skipped, and that's it.

It would be better if this message was more visible and, if that is the only framework being run, checkov exited with an error or warning instead of trying to continue.

**Additional context**
Add any other context about the problem here.



Discussion:

Resolving patch:
diff --git a/checkov/common/runners/runner_registry.py b/checkov/common/runners/runner_registry.py
--- a/checkov/common/runners/runner_registry.py
+++ b/checkov/common/runners/runner_registry.py
@@ -81,7 +81,12 @@ def run(
             collect_skip_comments: bool = True,
             repo_root_for_plan_enrichment: list[str | Path] | None = None,
     ) -> list[Report]:
-        if len(self.runners) == 1:
+        if not self.runners:
+            logging.error('There are no runners to run. This can happen if you specify a file type and a framework that are not compatible '
+                          '(e.g., `--file xyz.yaml --framework terraform`), or if you specify a framework with missing dependencies (e.g., '
+                          'helm or kustomize, which require those tools to be on your system). Running with LOG_LEVEL=DEBUG may provide more information.')
+            return []
+        elif len(self.runners) == 1:
             runner_check_type = self.runners[0].check_type
             if self.licensing_integration.is_runner_valid(runner_check_type):
                 reports: Iterable[Report | list[Report]] = [


Test patch:
diff --git a/tests/common/runner_registry/test_runner_registry.py b/tests/common/runner_registry/test_runner_registry.py
--- a/tests/common/runner_registry/test_runner_registry.py
+++ b/tests/common/runner_registry/test_runner_registry.py
@@ -161,6 +161,23 @@ def test_compact_csv_output(self):
             row = content[1:][0]
             self.assertIn('bridgecrew.cloud', row)
 
+    def test_run_with_empty_frameworks(self):
+        # ensures that a run with a framework that gets filtered out (e.g. --framework terraform --file abc.yaml)
+        # returns an empty report
+
+        checkov_runners = [value for attr, value in CheckType.__dict__.items() if not attr.startswith("__")]
+        scan_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'plan_with_hcl_for_enrichment', 'tfplan.json')
+
+        runner_filter = RunnerFilter(framework=['terraform'], runners=checkov_runners)
+        runner_registry = RunnerRegistry('', runner_filter, *DEFAULT_RUNNERS)
+        runner_registry.filter_runners_for_files(['tfplan.json'])
+        with self.assertLogs(level='ERROR') as log:
+            reports = runner_registry.run(root_folder=None, files=[scan_file])
+            self.assertEqual(len(reports), 0)  # checking that we get an empty report, not an exception
+            self.assertIn(
+                'There are no runners to run. This can happen if you specify a file type and a framework that are not compatible',
+                ''.join(log.output))
+
     def test_runner_file_filter(self):
         checkov_runners = [value for attr, value in CheckType.__dict__.items() if not attr.startswith("__")]