Repository: apple/swift
File: utils/update_checkout/update_checkout/update_checkout.py (Python)

Code before:
    the user is prompted to re-run the script with the `--clone` option.

    This function also respects per-repository platform restrictions: if the
    current platform is not listed for a repo, that repo is ignored.

    Args:
        args (CliArguments): Parsed CLI arguments.
        config (Dict[str, Any]): deserialized `update-checkout-config.json`.
        scheme_map (Dict[str, str] | None): map of repo names to branches to check out.

    Returns:
        Prints a warning if any required repository is missing.
    """
    for repo in scheme_map:
        if _should_skip_repo(args, config, repo):
            continue

        if not args.source_root.joinpath(repo).exists():
            print(
                "You don't have all swift sources. "
                "Call this script with --clone to get them."
            )
            return


def _check_git_config(
    args: CliArguments, config: Dict[str, Any], scheme_map: Dict[str, Any]
):
    """
    Verify git configuration for all cloned repositories.
    Warns if core.symlinks or core.autocrlf are not set correctly.

    Args:
        args (CliArguments): Parsed CLI arguments.
        config (Dict[str, Any]): deserialized `update-checkout-config.json`.
        scheme_map (Dict[str, str] | None): map of repo names to branches to check out.

    Returns:
        Prints a warning if any required repository is missing.
    """
    git_configs = {
        "core.symlinks": "true",
        "core.autocrlf": "false",
    }

    for repo in scheme_map:
        if _should_skip_repo(args, config, repo):
            continue

        repo_path = args.source_root.joinpath(repo)
        if not repo_path.exists():

Review comment (suggestion):
Is there something like `Void` return to make it explicit that no value is returned? Especially since `Returns` section in the doc string below is not clear on that matter (it mentions printing, but nothing about returning or not returning anything).

Code after:
    the user is prompted to re-run the script with the `--clone` option.

    This function also respects per-repository platform restrictions: if the
    current platform is not listed for a repo, that repo is ignored.

    Args:
        args (CliArguments): Parsed CLI arguments.
        config (Dict[str, Any]): deserialized `update-checkout-config.json`.
        scheme_map (Dict[str, str] | None): map of repo names to branches to check out.
    """

    for repo in scheme_map:
        if _should_skip_repo(args, config, repo):
            continue

        if not args.source_root.joinpath(repo).exists():
            print(
                "You don't have all swift sources. "
                "Call this script with --clone to get them."
            )
            return


def _check_git_config(
    args: CliArguments, config: Dict[str, Any], scheme_map: Dict[str, Any]
):
    """
    Verify git configuration for all cloned repositories.
    Warns if core.symlinks or core.autocrlf are not set correctly.

    Args:
        args (CliArguments): Parsed CLI arguments.
        config (Dict[str, Any]): deserialized `update-checkout-config.json`.
        scheme_map (Dict[str, str] | None): map of repo names to branches to check out.
    """

    git_configs = {
        "core.symlinks": "true",
        "core.autocrlf": "false",
    }

    for repo in scheme_map:
        if _should_skip_repo(args, config, repo):
            continue

        repo_path = args.source_root.joinpath(repo)
        if not repo_path.exists():
            continue

        for config_key, expected_value in git_configs.items():
            try: