Repository: bridgecrewio/checkov
Pull request: Fix mypy issues for json runner and yaml runner
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Fixes #2761 

Problem statement:
Fix type hint issues in json_doc and yaml_doc
**Describe the issue**
For better code quality and reducing errors, which can be found via statical type checking the `json_doc` and `yaml_doc` code base needs to be checked for correct type hint definition.

**Additional context**
the current output from `mypy` after removing `json_doc` and `yaml_doc` from the exclude list
```shell
$ pipenv run mypy
checkov/yaml_doc/base_registry.py:7: error: Function is missing a return type annotation  [no-untyped-def]
checkov/yaml_doc/base_registry.py:7: note: Use "-> None" if function does not return a value
checkov/yaml_doc/base_registry.py:14: error: Function is missing a type annotation  [no-untyped-def]
checkov/yaml_doc/base_registry.py:21: error: Call to untyped function "update_result" in typed context  [no-untyped-call]
checkov/yaml_doc/base_registry.py:33: error: Call to untyped function "update_result" in typed context  [no-untyped-call]
checkov/yaml_doc/base_registry.py:45: error: Function is missing a type annotation  [no-untyped-def]
checkov/yaml_doc/base_registry.py:49: error: Call to untyped function "update_result" in typed context  [no-untyped-call]
checkov/yaml_doc/base_registry.py:59: error: Function is missing a type annotation  [no-untyped-def]
checkov/yaml_doc/base_registry.py:62: error: Call to untyped function "update_result" in typed context  [no-untyped-call]
checkov/yaml_doc/base_registry.py:66: error: Function is missing a type annotation  [no-untyped-def]
checkov/yaml_doc/base_registry.py:94: error: Call to untyped function (unknown) in typed context  [no-untyped-call]
checkov/yaml_doc/base_registry.py:104: error: Function is missing a type annotation  [no-untyped-def]
checkov/yaml_doc/base_registry.py:105: error: Need type annotation for "results" (hint: "results: Dict[<type>, <type>] = ...")  [var-annotated]
checkov/yaml_doc/base_registry.py:111: error: Call to untyped function "_scan_yaml" in typed context  [no-untyped-call]
checkov/yaml_doc/base_registry.py:123: error: Call to untyped function "_scan_yaml" in typed context  [no-untyped-call]
checkov/yaml_doc/base_registry.py:136: error: Function is missing a type annotation  [no-untyped-def]
checkov/json_doc/base_registry.py:7: error: Function is missing a return type annotation  [no-untyped-def]
checkov/json_doc/base_registry.py:7: note: Use "-> None" if function does not return a value
checkov/json_doc/base_registry.py:14: error: Function is missing a type annotation  [no-untyped-def]
checkov/json_doc/base_registry.py:19: error: Call to untyped function "update_result" in typed context  [no-untyped-call]
checkov/json_doc/base_registry.py:32: error: Function is missing a type annotation  [no-untyped-def]
checkov/json_doc/base_registry.py:36: error: Call to untyped function "update_result" in typed context  [no-untyped-call]
checkov/json_doc/base_registry.py:46: error: Function is missing a type annotation  [no-untyped-def]
checkov/json_doc/base_registry.py:49: error: Call to untyped function "update_result" in typed context  [no-untyped-call]
checkov/json_doc/base_registry.py:53: error: Function is missing a type annotation  [no-untyped-def]
checkov/json_doc/base_registry.py:81: error: Call to untyped function (unknown) in typed context  [no-untyped-call]
checkov/json_doc/base_registry.py:91: error: Function is missing a type annotation  [no-untyped-def]
checkov/json_doc/base_registry.py:92: error: Need type annotation for "results" (hint: "results: Dict[<type>, <type>] = ...")  [var-annotated]
checkov/json_doc/base_registry.py:98: error: Call to untyped function "_scan_json" in typed context  [no-untyped-call]
checkov/json_doc/base_registry.py:110: error: Call to untyped function "_scan_json" in typed context  [no-untyped-call]
checkov/json_doc/base_registry.py:123: error: Function is missing a type annotation  [no-untyped-def]
checkov/yaml_doc/registry.py:3: error: Call to untyped function "Registry" in typed context  [no-untyped-call]
checkov/json_doc/registry.py:3: error: Call to untyped function "Registry" in typed context  [no-untyped-call]
checkov/yaml_doc/runner.py:20: error: Returning Any from function declared to return "Union[Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], List[Tuple[int, str]]], Tuple[None, None]]"  [no-any-return]
checkov/yaml_doc/base_yaml_check.py:7: error: Function is missing a type annotation  [no-untyped-def]
checkov/json_doc/runner.py:19: error: Returning Any from function declared to return "Union[Tuple[Union[Dict[str, Any], List[Dict[str, Any]]], List[Tuple[int, str]]], Tuple[None, None]]"  [no-any-return]
checkov/json_doc/runner.py:22: error: "Dict[str, Any]" has no attribute "start_mark"  [attr-defined]
checkov/json_doc/runner.py:23: error: "Dict[str, Any]" has no attribute "end_mark"  [attr-defined]
checkov/json_doc/base_json_check.py:7: error: Function is missing a type annotation  [no-untyped-def]
checkov/openapi/runner.py:40: error: Argument 1 to "is_valid" of "Runner" has incompatible type "Union[Dict[str, Any], List[Dict[str, Any]], None]"; expected "Dict[str, Any]"  [arg-type]
checkov/openapi/runner.py:44: error: Argument 1 to "is_valid" of "Runner" has incompatible type "Union[Dict[str, Any], List[Dict[str, Any]], None]"; expected "Dict[str, Any]"  [arg-type]
Found 39 errors in 9 files (checked 53 source files)

```

Hints from issue discussion:

Commit message: Fix annotation

Patch to review:
diff --git a/checkov/common/checks/base_check.py b/checkov/common/checks/base_check.py
index 7f1918dd1f..23fd586eab 100644
--- a/checkov/common/checks/base_check.py
+++ b/checkov/common/checks/base_check.py
@@ -14,6 +14,8 @@ class BaseCheck(metaclass=MultiSignatureMeta):
     name = ""
     categories: "Iterable[CheckCategories]" = ()
     supported_entities: "Iterable[str]" = ()
+    block_type: str
+    path: Optional[str]
 
     def __init__(
         self,
diff --git a/checkov/common/runners/object_runner.py b/checkov/common/runners/object_runner.py
index efeb9e9f6e..86794afbad 100644
--- a/checkov/common/runners/object_runner.py
+++ b/checkov/common/runners/object_runner.py
@@ -83,7 +83,7 @@ def run(
                     bc_check_id=check.bc_id,
                     check_name=check.name,
                     check_result=result,
-                    code_block=definitions_raw[file_path][start : end + 1],
+                    code_block=definitions_raw[file_path][start:end + 1],
                     file_path=file_path,
                     file_line_range=[start + 1, end + 1],
                     resource=f"{file_path}.{key}",
diff --git a/checkov/common/typing.py b/checkov/common/typing.py
index 3c75d526bf..d520e019fd 100644
--- a/checkov/common/typing.py
+++ b/checkov/common/typing.py
@@ -1,17 +1,20 @@
 from __future__ import annotations
 
-from typing import TYPE_CHECKING
+from typing import TYPE_CHECKING, Optional
 
 from typing_extensions import TypedDict
 
 if TYPE_CHECKING:
     from checkov.common.models.enums import CheckResult
+    from checkov.common.checks.base_check import BaseCheck
 
 
 class _CheckResult(TypedDict, total=False):
     result: "CheckResult"
     suppress_comment: str
     evaluated_keys: list[str]
+    results_configuration: Optional[dict]
+    check: BaseCheck
 
 
 class _SkippedCheck(TypedDict, total=False):
diff --git a/checkov/example_runner/runner.py b/checkov/example_runner/runner.py
index 737c2bb748..2d47bdd7b4 100644
--- a/checkov/example_runner/runner.py
+++ b/checkov/example_runner/runner.py
@@ -50,7 +50,7 @@ def _parse_file(
         # as the file is always located in a predictable path
         # There should always be a conditional otherwise you'll parse ALL files.
         if ".github/workflows/" in os.path.abspath(f):
-            return super()._parse_file(f)  # type:ignore[no-any-return]  # for some reason it can't get the right type
+            return super()._parse_file(f)
 
         return None, None
 
diff --git a/checkov/json_doc/base_json_check.py b/checkov/json_doc/base_json_check.py
index 07e53eaf73..d406251fe7 100644
--- a/checkov/json_doc/base_json_check.py
+++ b/checkov/json_doc/base_json_check.py
@@ -1,10 +1,13 @@
-from checkov.common.checks.base_check import BaseCheck
+from typing import Iterable, Optional
 
+from checkov.common.checks.base_check import BaseCheck
+from checkov.common.models.enums import CheckCategories
 from checkov.json_doc.registry import registry
 
 
 class BaseJsonCheck(BaseCheck):
-    def __init__(self, name, id, categories, supported_entities, block_type, path=None):
+    def __init__(self, name: str, id: str, categories: "Iterable[CheckCategories]", supported_entities: Iterable[str],
+                 block_type: str, path: Optional[str] = None) -> None:
         super().__init__(
             name=name,
             id=id,
diff --git a/checkov/json_doc/base_registry.py b/checkov/json_doc/base_registry.py
index 884e058959..595b5a5dc3 100644
--- a/checkov/json_doc/base_registry.py
+++ b/checkov/json_doc/base_registry.py
@@ -1,19 +1,25 @@
+from typing import Any, Dict, List, Callable, Union
+
+from checkov.common.checks.base_check import BaseCheck
 from checkov.common.checks.base_check_registry import BaseCheckRegistry
 from checkov.common.models.enums import CheckResult
+from checkov.common.typing import _SkippedCheck
 from checkov.json_doc.enums import BlockType
+from checkov.runner_filter import RunnerFilter
 
 
 class Registry(BaseCheckRegistry):
-    def __init__(self):
+    def __init__(self) -> None:
         super().__init__()
-        self._scanner = {
+        self._scanner: Dict[str, Callable[[str, Any, Any, Any, str, str, Dict[str, Any]], None]] = {
             BlockType.ARRAY: self._scan_json_array,
             BlockType.OBJECT: self._scan_json_object,
         }
 
     def _scan_json_array(
-        self, scanned_file, check, skip_info, entity, entity_name, entity_type, results
-    ):
+        self, scanned_file: str, check: BaseCheck, skip_info: _SkippedCheck, entity: List[Dict[str, Any]],
+            entity_name: str, entity_type: str, results: Dict[str, Any]
+    ) -> None:
         for item in entity:
             if entity_name in item:
                 result = self.update_result(
@@ -30,8 +36,9 @@ def _scan_json_array(
                     break
 
     def _scan_json_object(
-        self, scanned_file, check, skip_info, entity, entity_name, entity_type, results
-    ):
+        self, scanned_file: str, check: BaseCheck, skip_info: _SkippedCheck, entity: Dict[str, Any],
+            entity_name: str, entity_type: str, results: Dict[str, Any]
+    ) -> None:
         if entity_name in entity:
             self.update_result(
                 check,
@@ -44,28 +51,29 @@ def _scan_json_object(
             )
 
     def _scan_json_document(
-        self, scanned_file, check, skip_info, entity, entity_name, entity_type, results
-    ):
+        self, scanned_file: str, check: BaseCheck, skip_info: _SkippedCheck, entity: Dict[str, Any], entity_name: str,
+            entity_type: str, results: Dict[str, Any]
+    ) -> None:
         self.update_result(
             check, entity, entity_name, entity_type, results, scanned_file, skip_info
         )
 
     def _scan_json(
         self,
-        scanned_file,
-        checks,
-        skipped_checks,
-        runner_filter,
-        entity,
-        entity_name,
-        entity_type,
-        results,
-    ):
+        scanned_file: str,
+        checks: List[BaseCheck],
+        skipped_checks: List[_SkippedCheck],
+        runner_filter: RunnerFilter,
+        entity: Dict[str, Any],
+        entity_name: str,
+        entity_type: str,
+        results: Dict[str, Any],
+    ) -> None:
         for check in checks:
             skip_info = ([x for x in skipped_checks if x["id"] == check.id] or [{}])[0]
 
             if runner_filter.should_run_check(check=check):
-                scanner = self._scanner.get(check.block_type, self._scan_json_document)
+                scanner: Callable[[str, Any, Any, Any, str, str, Dict[str, Any]], None] = self._scanner.get(check.block_type, self._scan_json_document)
                 if check.path:
                     target = entity
                     for p in check.path.split("."):
@@ -88,8 +96,9 @@ def _scan_json(
                     results,
                 )
 
-    def scan(self, scanned_file, entity, skipped_checks, runner_filter):
-        results = {}
+    def scan(self, scanned_file: str, entity: Dict[str, Any], skipped_checks: List[_SkippedCheck],
+             runner_filter: RunnerFilter) -> Dict[str, Any]:
+        results: Dict[str, Any] = {}
 
         if not entity:
             return results
@@ -122,14 +131,14 @@ def scan(self, scanned_file, entity, skipped_checks, runner_filter):
 
     def update_result(
         self,
-        check,
-        entity_configuration,
-        entity_name,
-        entity_type,
-        results,
-        scanned_file,
-        skip_info,
-    ):
+        check: BaseCheck,
+        entity_configuration: Dict[str, Any],
+        entity_name: str,
+        entity_type: str,
+        results: Dict[str, Any],
+        scanned_file: str,
+        skip_info: _SkippedCheck,
+    ) -> CheckResult:
         check_result = self.run_check(
             check,
             entity_configuration,
diff --git a/checkov/json_doc/runner.py b/checkov/json_doc/runner.py
index 9cb45173f8..08e3c92d6e 100644
--- a/checkov/json_doc/runner.py
+++ b/checkov/json_doc/runner.py
@@ -1,19 +1,26 @@
+from __future__ import annotations
+
+from typing import Any
+
 from checkov.common.output.report import CheckType
 from checkov.common.parsers.json import parse
+from checkov.common.parsers.node import DictNode
 from checkov.common.runners.object_runner import Runner as ObjectRunner
+from checkov.json_doc.base_registry import Registry
 
 
 class Runner(ObjectRunner):
     check_type = CheckType.JSON
 
-    def import_registry(self):
+    def import_registry(self) -> Registry:
         from checkov.json_doc.registry import registry
         return registry
 
-    def _parse_file(self, f):
-        return parse(f)
+    def _parse_file(self, f: str) -> tuple[dict[str, Any] | list[dict[str, Any]], list[tuple[int, str]]] | tuple[None, None]:
+        content: tuple[dict[str, Any] | list[dict[str, Any]], list[tuple[int, str]]] | tuple[None, None] = parse(f)
+        return content
 
-    def get_start_end_lines(self, end, result_config, start):
+    def get_start_end_lines(self, end: int, result_config: DictNode, start: int) -> tuple[int, int]:
         start = result_config.start_mark.line
         end = result_config.end_mark.line
         return end, start
diff --git a/checkov/sca_package/runner.py b/checkov/sca_package/runner.py
index 88db0105bf..f37c6a453c 100644
--- a/checkov/sca_package/runner.py
+++ b/checkov/sca_package/runner.py
@@ -22,9 +22,13 @@
     "package.json",
     "package-lock.json",
     "pom.xml",
-    "requirements.txt",
+    "requirements.txt"
 }
 
+SUPPORTED_PACKAGE_EXTENSIONS = [
+    ".gemspec"
+]
+
 
 class Runner(BaseRunner):
     check_type = CheckType.SCA_PACKAGE
@@ -34,12 +38,12 @@ def __init__(self):
         self._code_repo_path: Optional[Path] = None
 
     def prepare_and_scan(
-        self,
-        root_folder: Optional[Union[str, Path]],
-        files: Optional[List[str]] = None,
-        runner_filter: RunnerFilter = RunnerFilter(),
-        exclude_package_json: bool = True,
-        cleanup_twistcli: bool = True,
+            self,
+            root_folder: Optional[Union[str, Path]],
+            files: Optional[List[str]] = None,
+            runner_filter: RunnerFilter = RunnerFilter(),
+            exclude_package_json: bool = True,
+            cleanup_twistcli: bool = True,
     ) -> "Optional[Sequence[Dict[str, Any]]]":
 
         if not strtobool(os.getenv("ENABLE_SCA_PACKAGE_SCAN", "False")):
@@ -81,12 +85,12 @@ def prepare_and_scan(
         return scan_results
 
     def run(
-        self,
-        root_folder: Union[str, Path],
-        external_checks_dir: Optional[List[str]] = None,
-        files: Optional[List[str]] = None,
-        runner_filter: RunnerFilter = RunnerFilter(),
-        collect_skip_comments: bool = True,
+            self,
+            root_folder: Union[str, Path],
+            external_checks_dir: Optional[List[str]] = None,
+            files: Optional[List[str]] = None,
+            runner_filter: RunnerFilter = RunnerFilter(),
+            collect_skip_comments: bool = True,
     ) -> Report:
         report = Report(self.check_type)
 
@@ -134,14 +138,17 @@ def parse_vulns_to_records(self, report, result, rootless_file_path, runner_filt
             report.add_record(record)
 
     def find_scannable_files(
-        self, root_path: Optional[Path], files: Optional[List[str]], excluded_paths: Set[str], exclude_package_json: bool = True
+            self, root_path: Optional[Path], files: Optional[List[str]], excluded_paths: Set[str],
+            exclude_package_json: bool = True
     ) -> Set[Tuple[Path, Path]]:
         input_output_paths: Set[Tuple[Path, Path]] = set()
         if root_path:
             input_paths = {
                 file_path
                 for file_path in root_path.glob("**/*")
-                if file_path.name in SUPPORTED_PACKAGE_FILES and not any(p in file_path.parts for p in excluded_paths)
+                if (not any(p in file_path.parts for p in excluded_paths) and
+                    (file_path.name in SUPPORTED_PACKAGE_FILES or
+                     any(file_path.name.endswith(ext) for ext in SUPPORTED_PACKAGE_EXTENSIONS)))
             }
 
             package_lock_parent_paths = set()
diff --git a/checkov/yaml_doc/base_registry.py b/checkov/yaml_doc/base_registry.py
index d306ebd88a..83e0314dc8 100644
--- a/checkov/yaml_doc/base_registry.py
+++ b/checkov/yaml_doc/base_registry.py
@@ -1,10 +1,15 @@
+from typing import Any, Dict, List
+
+from checkov.common.checks.base_check import BaseCheck
 from checkov.common.checks.base_check_registry import BaseCheckRegistry
 from checkov.common.models.enums import CheckResult
+from checkov.common.typing import _SkippedCheck
+from checkov.runner_filter import RunnerFilter
 from checkov.yaml_doc.enums import BlockType
 
 
 class Registry(BaseCheckRegistry):
-    def __init__(self):
+    def __init__(self) -> None:
         super().__init__()
         self._scanner = {
             BlockType.ARRAY: self._scan_yaml_array,
@@ -12,13 +17,14 @@ def __init__(self):
         }
 
     def _scan_yaml_array(
-            self, scanned_file, check, skip_info, entity, entity_name, entity_type, results
-    ):
+            self, scanned_file: str, check: BaseCheck, skip_info: _SkippedCheck, entity: Dict[str, Any], entity_name: str,
+            entity_type: str, results: Dict[str, Any]
+    ) -> None:
         if isinstance(entity, dict):
             analayzed_dict = entity.get(entity_type, {})
             for item, item_conf in analayzed_dict.items():
                 if '__startline__' != item and '__endline__' != item:
-                    result = self.update_result(
+                    self.update_result(
                         check,
                         item_conf,
                         item,
@@ -43,8 +49,9 @@ def _scan_yaml_array(
                         break
 
     def _scan_yaml_object(
-            self, scanned_file, check, skip_info, entity, entity_name, entity_type, results
-    ):
+            self, scanned_file: str, check: BaseCheck, skip_info: _SkippedCheck, entity: Dict[str, Any], entity_name: str,
+            entity_type: str, results: Dict[str, Any]
+    ) -> None:
         if entity_name in entity:
             self.update_result(
                 check,
@@ -57,23 +64,24 @@ def _scan_yaml_object(
             )
 
     def _scan_yaml_document(
-            self, scanned_file, check, skip_info, entity, entity_name, entity_type, results
-    ):
+            self, scanned_file: str, check: BaseCheck, skip_info: _SkippedCheck, entity: Dict[str, Any], entity_name: str,
+            entity_type: str, results: Dict[str, Any]
+    ) -> None:
         self.update_result(
             check, entity, entity_name, entity_type, results, scanned_file, skip_info
         )
 
     def _scan_yaml(
             self,
-            scanned_file,
-            checks,
-            skipped_checks,
-            runner_filter,
-            entity,
-            entity_name,
-            entity_type,
-            results,
-    ):
+            scanned_file: str,
+            checks: List[BaseCheck],
+            skipped_checks: List[_SkippedCheck],
+            runner_filter: RunnerFilter,
+            entity: Dict[str, Any],
+            entity_name: str,
+            entity_type: str,
+            results: Dict[str, Any],
+    ) -> None:
         for check in checks:
             skip_info = ([x for x in skipped_checks if x["id"] == check.id] or [{}])[0]
 
@@ -101,8 +109,9 @@ def _scan_yaml(
                     results,
                 )
 
-    def scan(self, scanned_file, entity, skipped_checks, runner_filter):
-        results = {}
+    def scan(self, scanned_file: str, entity: Dict[str, Any], skipped_checks: List[_SkippedCheck],
+             runner_filter: RunnerFilter) -> Dict[str, Any]:
+        results: Dict[str, Any] = {}
 
         if not entity:
             return results
@@ -135,14 +144,14 @@ def scan(self, scanned_file, entity, skipped_checks, runner_filter):
 
     def update_result(
             self,
-            check,
-            entity_configuration,
-            entity_name,
-            entity_type,
-            results,
-            scanned_file,
-            skip_info,
-    ):
+            check: BaseCheck,
+            entity_configuration: Dict[str, Any],
+            entity_name: str,
+            entity_type: str,
+            results: Dict[str, Any],
+            scanned_file: str,
+            skip_info: _SkippedCheck,
+    ) -> CheckResult:
         check_result = self.run_check(
             check,
             entity_configuration,
diff --git a/checkov/yaml_doc/base_yaml_check.py b/checkov/yaml_doc/base_yaml_check.py
index 865922d782..af7e4410f3 100644
--- a/checkov/yaml_doc/base_yaml_check.py
+++ b/checkov/yaml_doc/base_yaml_check.py
@@ -1,10 +1,15 @@
+from typing import Iterable, Optional
+
 from checkov.common.checks.base_check import BaseCheck
+from checkov.common.graph.graph_builder.graph_components.block_types import BlockType
+from checkov.common.models.enums import CheckCategories
 
 from checkov.yaml_doc.registry import registry
 
 
 class BaseYamlCheck(BaseCheck):
-    def __init__(self, name, id, categories, supported_entities, block_type, path=None):
+    def __init__(self, name: str, id: str, categories: "Iterable[CheckCategories]", supported_entities: "Iterable[str]",
+                 block_type: BlockType, path: Optional[str] = None) -> None:
         super().__init__(
             name=name,
             id=id,
diff --git a/checkov/yaml_doc/runner.py b/checkov/yaml_doc/runner.py
index bbb0d11013..6a696dd96a 100644
--- a/checkov/yaml_doc/runner.py
+++ b/checkov/yaml_doc/runner.py
@@ -21,7 +21,7 @@ def import_registry(self) -> BaseCheckRegistry:
     def _parse_file(
         self, f: str
     ) -> tuple[dict[str, Any] | list[dict[str, Any]], list[tuple[int, str]]] | tuple[None, None]:
-        content = parse(f)
+        content: tuple[dict[str, Any] | list[dict[str, Any]], list[tuple[int, str]]] | tuple[None, None] = parse(f)
         return content
 
     def get_start_end_lines(
diff --git a/mypy.ini b/mypy.ini
index ddac03bdc6..6c78bfba27 100644
--- a/mypy.ini
+++ b/mypy.ini
@@ -1,6 +1,6 @@
 [mypy]
 files = checkov
-exclude = checkov/(arm|cloudformation|common|dockerfile|github|bitbucket|gitlab|helm|json_doc|yaml_doc|kubernetes|kustomize|sca_package|secrets|serverless|terraform)
+exclude = checkov/(arm|cloudformation|common|dockerfile|github|bitbucket|gitlab|helm|kubernetes|kustomize|sca_package|secrets|serverless|terraform)
 strict = True
 ignore_missing_imports = True
 disallow_subclassing_any = False


Code review comments:
diff_hunk: @@ -134,14 +138,17 @@ def parse_vulns_to_records(self, report, result, rootless_file_path, runner_filt
             report.add_record(record)
 
     def find_scannable_files(
-        self, root_path: Optional[Path], files: Optional[List[str]], excluded_paths: Set[str], exclude_package_json: bool = True
+            self, root_path: Optional[Path], files: Optional[List[str]], excluded_paths: Set[str],
+            exclude_package_json: bool = True
     ) -> Set[Tuple[Path, Path]]:
         input_output_paths: Set[Tuple[Path, Path]] = set()
         if root_path:
             input_paths = {
                 file_path
                 for file_path in root_path.glob("**/*")
-                if file_path.name in SUPPORTED_PACKAGE_FILES and not any(p in file_path.parts for p in excluded_paths)
+                if (not any(p in file_path.parts for p in excluded_paths) and
+                    (file_path.name in SUPPORTED_PACKAGE_FILES or
+                     any(file_path.name.endswith(ext) for ext in SUPPORTED_PACKAGE_EXTENSIONS)))
path: checkov/sca_package/runner.py
text: @user1:
```suggestion
                     file_path.name.endswith(SUPPORTED_PACKAGE_EXTENSIONS)))
```
when you change `SUPPORTED_PACKAGE_EXTENSIONS` to a `tuple`, then you can directly pass it into `endswith`