Fix -f support for SCA scanning
@@ -25,6 +25,7 @@ SUPPORTED_PACKAGE_FILES = {
"requirements.txt",
}
+
class Runner(BaseRunner):
check_type = CheckType.SCA_PACKAGE
@@ -34,7 +35,7 @@ class Runner(BaseRunner):
def prepare_and_scan(
self,
- root_folder: Union[str, Path],
+ root_folder: Optional[Union[str, Path]],
files: Optional[List[str]] = None,
runner_filter: RunnerFilter = RunnerFilter(),
exclude_package_json: bool = True,
@@ -54,7 +55,7 @@ class Runner(BaseRunner):
logging.info("SCA package scanning searching for scannable files")
- self._code_repo_path = Path(root_folder)
+ self._code_repo_path = Path(root_folder) if root_folder else None
excluded_paths = {*ignored_directories}
if runner_filter.excluded_paths:
@@ -95,6 +96,7 @@ class Runner(BaseRunner):
for result in scan_results:
package_file_path = Path(result["repository"])
+ if self._code_repo_path:
try:
package_file_path = package_file_path.relative_to(self._code_repo_path)
except ValueError:
@@ -132,8 +134,10 @@ class Runner(BaseRunner):
report.add_record(record)
def find_scannable_files(
- self, root_path: 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("**/*")
