fn check_repositories()

in kernel-compliance-check/src/main.rs [56:119]


fn check_repositories(
    repos: &str,
    manylinux: &str,
    python_abi: &str,
    prefer_hub_cli: bool,
    force_fetch: bool,
    revision: &str,
    long: bool,
    show_violations: bool,
    format: Format,
    non_standard_cache: Option<&String>,
) -> Result<()> {
    let repositories: Vec<String> = repos
        .split(',')
        .map(|s| s.trim().to_owned())
        .filter(|s| !s.is_empty())
        .collect();

    if repositories.is_empty() {
        #[derive(serde::Serialize)]
        struct ErrorResponse {
            status: &'static str,
            error: &'static str,
        }

        if format.is_json() {
            let error = ErrorResponse {
                status: "error",
                error: "no repository ids provided",
            };
            let json = serde_json::to_string_pretty(&error)
                .context("Failed to serialize error response")?;
            println!("{json}");
        } else {
            eprintln!("no repository ids provided");
        }
        return Ok(());
    }

    let python_version = Version::from_str(python_abi)
        .map_err(|e| eyre::eyre!("Invalid Python ABI version {}: {}", python_abi, e))?;

    for repo_id in &repositories {
        if let Err(e) = process_repository(
            repo_id,
            revision,
            force_fetch,
            prefer_hub_cli,
            manylinux,
            &python_version,
            !long,
            show_violations,
            format,
            non_standard_cache,
        ) {
            eprintln!("Error processing repository {repo_id}: {e}");

            // Continue processing other repositories rather than exiting early
            // This is more user-friendly for batch processing
        }
    }

    Ok(())
}