(
    ctx: click.Context, paths: List[str], recursive: bool, yes: bool
)
scan files and directories.
scan files and directories.
scan files and directories .
def path_cmd(
    ctx: click.Context, paths: List[str], recursive: bool, yes: bool
) -> int:  # pragma: no cover
    """
    scan files and directories.
    """
    config = ctx.obj["config"]
    output_handler: OutputHandler = ctx.obj["output_handler"]
    try:
        files = get_files_from_paths(
            paths=paths,
            exclusion_regexes=ctx.obj["exclusion_regexes"],
            recursive=recursive,
            yes=yes,
            verbose=config.verbose,
            # when scanning a path explicitly we should not care if it is a git repository or not
            ignore_git=True,
        )
        results = files.scan(
            client=ctx.obj["client"],
            cache=ctx.obj["cache"],
            matches_ignore=config.matches_ignore,
            banlisted_detectors=config.banlisted_detectors,
            all_policies=config.all_policies,
            verbose=config.verbose,
            mode_header=SupportedScanMode.PATH.value,
        )
        scan = ScanCollection(id=" ".join(paths), type="path_scan", results=results)

        return output_handler.process_scan(scan)
    except Exception as error:
        return handle_exception(error, config.verbose)
def path_cmd ( ctx : click . Context , paths : List [ str ] , recursive : bool , yes : bool ) -> int : # pragma: no cover config = ctx . obj [ "config" ] output_handler : OutputHandler = ctx . obj [ "output_handler" ] try : files = get_files_from_paths ( paths = paths , exclusion_regexes = ctx . obj [ "exclusion_regexes" ] , recursive = recursive , yes = yes , verbose = config . verbose , # when scanning a path explicitly we should not care if it is a git repository or not ignore_git = True , ) results = files . scan ( client = ctx . obj [ "client" ] , cache = ctx . obj [ "cache" ] , matches_ignore = config . matches_ignore , banlisted_detectors = config . banlisted_detectors , all_policies = config . all_policies , verbose = config . verbose , mode_header = SupportedScanMode . PATH . value , ) scan = ScanCollection ( id = " " . join ( paths ) , type = "path_scan" , results = results ) return output_handler . process_scan ( scan ) except Exception as error : return handle_exception ( error , config . verbose )