(
    ctx: click.Context,
    show_secrets: bool,
    exit_zero: bool,
    all_policies: bool,
    verbose: bool,
    json_output: bool,
    output: Optional[str],
    banlist_detector: Optional[List[str]] = None,
    exclude: Optional[List[str]] = None,
    ignore_default_excludes: bool = False,
)
return return_code
Command to scan various contents.
Command to scan various contents.
Command to scan various contents .
def scan(
    ctx: click.Context,
    show_secrets: bool,
    exit_zero: bool,
    all_policies: bool,
    verbose: bool,
    json_output: bool,
    output: Optional[str],
    banlist_detector: Optional[List[str]] = None,
    exclude: Optional[List[str]] = None,
    ignore_default_excludes: bool = False,
) -> int:
    """Command to scan various contents."""
    ctx.obj["client"] = retrieve_client(ctx)
    return_code = 0

    paths_ignore = ctx.obj["config"].paths_ignore
    if exclude is not None:
        paths_ignore.update(exclude)

    if not ignore_default_excludes and not ctx.obj["config"].ignore_default_excludes:
        paths_ignore.update(IGNORED_DEFAULT_PATTERNS)

    ctx.obj["exclusion_regexes"] = init_exclusion_regexes(paths_ignore)
    config: Config = ctx.obj["config"]

    if show_secrets is not None:
        config.show_secrets = show_secrets

    if all_policies is not None:
        config.all_policies = all_policies

    if verbose is not None:
        config.verbose = verbose

    if exit_zero is not None:
        config.exit_zero = exit_zero

    if banlist_detector:
        config.banlisted_detectors.update(banlist_detector)

    max_commits = get_max_commits_for_hook()
    if max_commits:
        config.max_commits_for_hook = max_commits

    output_handler_cls: Type[OutputHandler] = TextOutputHandler
    if json_output:
        output_handler_cls = JSONOutputHandler

    ctx.obj["output_handler"] = output_handler_cls(
        show_secrets=config.show_secrets, verbose=config.verbose, output=output
    )

    return return_code
def scan ( ctx : click . Context , show_secrets : bool , exit_zero : bool , all_policies : bool , verbose : bool , json_output : bool , output : Optional [ str ] , banlist_detector : Optional [ List [ str ] ] = None , exclude : Optional [ List [ str ] ] = None , ignore_default_excludes : bool = False , ) -> int : ctx . obj [ "client" ] = retrieve_client ( ctx ) return_code = 0 paths_ignore = ctx . obj [ "config" ] . paths_ignore if exclude is not None : paths_ignore . update ( exclude ) if not ignore_default_excludes and not ctx . obj [ "config" ] . ignore_default_excludes : paths_ignore . update ( IGNORED_DEFAULT_PATTERNS ) ctx . obj [ "exclusion_regexes" ] = init_exclusion_regexes ( paths_ignore ) config : Config = ctx . obj [ "config" ] if show_secrets is not None : config . show_secrets = show_secrets if all_policies is not None : config . all_policies = all_policies if verbose is not None : config . verbose = verbose if exit_zero is not None : config . exit_zero = exit_zero if banlist_detector : config . banlisted_detectors . update ( banlist_detector ) max_commits = get_max_commits_for_hook ( ) if max_commits : config . max_commits_for_hook = max_commits output_handler_cls : Type [ OutputHandler ] = TextOutputHandler if json_output : output_handler_cls = JSONOutputHandler ctx . obj [ "output_handler" ] = output_handler_cls ( show_secrets = config . show_secrets , verbose = config . verbose , output = output ) return return_code