← back to hsubra89__rlph

Function bodies 309 total

All specs Real LLM only Function bodies
test_parse_once function · rust · L126-L132 (7 LOC)
src/cli.rs
    fn test_parse_once() {
        let cli = Cli::parse_from(["rlph", "--once"]);
        assert!(cli.once);
        assert!(!cli.continuous);
        assert!(!cli.dry_run);
        assert!(cli.command.is_none());
    }
test_parse_all_overrides function · rust · L149-L172 (24 LOC)
src/cli.rs
    fn test_parse_all_overrides() {
        let cli = Cli::parse_from([
            "rlph",
            "--once",
            "--runner",
            "codex",
            "--source",
            "linear",
            "--submission",
            "graphite",
            "--label",
            "auto",
            "--poll-seconds",
            "30",
            "--worktree-dir",
            "/tmp/wt",
        ]);
        assert_eq!(cli.runner.as_deref(), Some("codex"));
        assert_eq!(cli.source.as_deref(), Some("linear"));
        assert_eq!(cli.submission.as_deref(), Some("graphite"));
        assert_eq!(cli.label.as_deref(), Some("auto"));
        assert_eq!(cli.poll_seconds, Some(30));
        assert_eq!(cli.worktree_dir.as_deref(), Some("/tmp/wt"));
    }
test_parse_init_allows_global_args_after_subcommand function · rust · L181-L186 (6 LOC)
src/cli.rs
    fn test_parse_init_allows_global_args_after_subcommand() {
        let cli = Cli::parse_from(["rlph", "init", "--source", "linear", "--label", "auto"]);
        assert!(matches!(cli.command, Some(CliCommand::Init)));
        assert_eq!(cli.source.as_deref(), Some("linear"));
        assert_eq!(cli.label.as_deref(), Some("auto"));
    }
test_parse_review function · rust · L189-L195 (7 LOC)
src/cli.rs
    fn test_parse_review() {
        let cli = Cli::parse_from(["rlph", "review", "123"]);
        match cli.command {
            Some(CliCommand::Review { pr_number }) => assert_eq!(pr_number, 123),
            _ => panic!("expected Review subcommand"),
        }
    }
test_parse_review_with_global_args_after_subcommand function · rust · L198-L208 (11 LOC)
src/cli.rs
    fn test_parse_review_with_global_args_after_subcommand() {
        let cli = Cli::parse_from([
            "rlph", "review", "77", "--source", "github", "--label", "rlph",
        ]);
        match cli.command {
            Some(CliCommand::Review { pr_number }) => assert_eq!(pr_number, 77),
            _ => panic!("expected Review subcommand"),
        }
        assert_eq!(cli.source.as_deref(), Some("github"));
        assert_eq!(cli.label.as_deref(), Some("rlph"));
    }
test_parse_prd_no_description function · rust · L211-L217 (7 LOC)
src/cli.rs
    fn test_parse_prd_no_description() {
        let cli = Cli::parse_from(["rlph", "prd"]);
        match cli.command {
            Some(CliCommand::Prd { description, .. }) => assert!(description.is_none()),
            _ => panic!("expected Prd subcommand"),
        }
    }
test_parse_prd_with_description function · rust · L220-L228 (9 LOC)
src/cli.rs
    fn test_parse_prd_with_description() {
        let cli = Cli::parse_from(["rlph", "prd", "add auth support"]);
        match cli.command {
            Some(CliCommand::Prd { description, .. }) => {
                assert_eq!(description.as_deref(), Some("add auth support"));
            }
            _ => panic!("expected Prd subcommand"),
        }
    }
Repobility's GitHub App fixes findings like these · https://github.com/apps/repobility-bot
test_parse_prd_with_overrides function · rust · L231-L254 (24 LOC)
src/cli.rs
    fn test_parse_prd_with_overrides() {
        let cli = Cli::parse_from([
            "rlph",
            "prd",
            "--runner",
            "codex",
            "--source",
            "linear",
            "my feature",
        ]);
        match cli.command {
            Some(CliCommand::Prd {
                description,
                runner,
                source,
                ..
            }) => {
                assert_eq!(description.as_deref(), Some("my feature"));
                assert_eq!(runner.as_deref(), Some("codex"));
                assert_eq!(source.as_deref(), Some("linear"));
            }
            _ => panic!("expected Prd subcommand"),
        }
    }
default_review_phases function · rust · L132-L162 (31 LOC)
src/config.rs
pub fn default_review_phases() -> Vec<ReviewPhaseConfig> {
    vec![
        ReviewPhaseConfig {
            name: "correctness".to_string(),
            prompt: "correctness-review".to_string(),
            runner: "claude".to_string(),
            agent_binary: "claude".to_string(),
            agent_model: None,
            agent_effort: None,
            agent_timeout: None,
        },
        ReviewPhaseConfig {
            name: "security".to_string(),
            prompt: "security-review".to_string(),
            runner: "claude".to_string(),
            agent_binary: "claude".to_string(),
            agent_model: None,
            agent_effort: None,
            agent_timeout: None,
        },
        ReviewPhaseConfig {
            name: "style".to_string(),
            prompt: "style-review".to_string(),
            runner: "claude".to_string(),
            agent_binary: "claude".to_string(),
            agent_model: None,
            agent_effort: None,
            agent_tim
default_review_step function · rust · L165-L174 (10 LOC)
src/config.rs
pub fn default_review_step(prompt: &str) -> ReviewStepConfig {
    ReviewStepConfig {
        prompt: prompt.to_string(),
        runner: "claude".to_string(),
        agent_binary: "claude".to_string(),
        agent_model: None,
        agent_effort: None,
        agent_timeout: None,
    }
}
resolve_init_config_from function · rust · L190-L216 (27 LOC)
src/config.rs
pub fn resolve_init_config_from(cli: &Cli, project_dir: &Path) -> Result<InitConfig> {
    let file = load_file_config(cli, project_dir)?;
    let source = cli
        .source
        .clone()
        .or(file.source)
        .unwrap_or_else(|| "github".to_string());

    match source.as_str() {
        "github" | "linear" => {}
        other => {
            return Err(Error::ConfigValidation(format!(
                "unknown source: {other} (expected: github, linear)"
            )));
        }
    }

    Ok(InitConfig {
        source,
        label: cli
            .label
            .clone()
            .or(file.label)
            .unwrap_or_else(|| "rlph".to_string()),
    })
}
load_file_config function · rust · L217-L238 (22 LOC)
src/config.rs
fn load_file_config(cli: &Cli, project_dir: &Path) -> Result<ConfigFile> {
    match &cli.config {
        Some(explicit_path) => {
            let path = Path::new(explicit_path);
            if !path.exists() {
                return Err(Error::ConfigNotFound(path.to_path_buf()));
            }
            let content = std::fs::read_to_string(path)?;
            parse_config(&content)
        }
        None => {
            let path = project_dir.join(DEFAULT_CONFIG_FILE);
            if path.exists() {
                let content = std::fs::read_to_string(&path)?;
                parse_config(&content)
            } else {
                Ok(ConfigFile::default())
            }
        }
    }
}
runner_default_binary function · rust · L244-L250 (7 LOC)
src/config.rs
fn runner_default_binary(runner: &str) -> &'static str {
    match runner {
        "codex" => "codex",
        _ => "claude",
    }
}
runner_default_model function · rust · L251-L257 (7 LOC)
src/config.rs
fn runner_default_model(runner: &str) -> Option<&'static str> {
    match runner {
        "codex" => Some("gpt-5.3-codex"),
        _ => Some("claude-opus-4-6"),
    }
}
runner_default_effort function · rust · L258-L264 (7 LOC)
src/config.rs
fn runner_default_effort(runner: &str) -> Option<&'static str> {
    match runner {
        "claude" => Some("high"),
        _ => None,
    }
}
Generated by Repobility's multi-pass static-analysis pipeline (https://repobility.com)
merge function · rust · L265-L431 (167 LOC)
src/config.rs
pub fn merge(file: ConfigFile, cli: &Cli) -> Result<Config> {
    let runner = cli
        .runner
        .clone()
        .or(file.runner)
        .unwrap_or_else(|| "claude".to_string());

    let default_binary = runner_default_binary(&runner);
    let default_model = runner_default_model(&runner);
    let default_effort = runner_default_effort(&runner);

    let linear = file.linear.map(|lc| LinearConfig {
        team: lc.team.unwrap_or_default(),
        project: lc.project,
        api_key_env: lc
            .api_key_env
            .unwrap_or_else(|| "LINEAR_API_KEY".to_string()),
        in_progress_state: lc
            .in_progress_state
            .unwrap_or_else(|| "In Progress".to_string()),
        in_review_state: lc
            .in_review_state
            .unwrap_or_else(|| "In Review".to_string()),
        done_state: lc.done_state.unwrap_or_else(|| "Done".to_string()),
    });

    let global_runner = &runner;
    let global_binary_override = cli.agent_binary.cl
validate function · rust · L432-L517 (86 LOC)
src/config.rs
fn validate(config: &Config) -> Result<()> {
    match config.source.as_str() {
        "github" | "linear" => {}
        other => {
            return Err(Error::ConfigValidation(format!(
                "unknown source: {other} (expected: github, linear)"
            )));
        }
    }
    match config.runner.as_str() {
        "claude" | "codex" => {}
        other => {
            return Err(Error::ConfigValidation(format!(
                "unknown runner: {other} (expected: claude, codex)"
            )));
        }
    }
    match config.submission.as_str() {
        "github" | "graphite" => {}
        other => {
            return Err(Error::ConfigValidation(format!(
                "unknown submission: {other} (expected: github, graphite)"
            )));
        }
    }
    if config.poll_seconds == 0 {
        return Err(Error::ConfigValidation(
            "poll_seconds must be > 0".to_string(),
        ));
    }
    if config.review_phases.is_empty() {
        return Er
validate_runner function · rust · L468-L475 (8 LOC)
src/config.rs
    fn validate_runner(runner: &str, context: &str) -> Result<()> {
        match runner {
            "claude" | "codex" => Ok(()),
            other => Err(Error::ConfigValidation(format!(
                "unknown runner '{other}' in {context}"
            ))),
        }
    }
test_parse_valid_config function · rust · L526-L538 (13 LOC)
src/config.rs
    fn test_parse_valid_config() {
        let toml = r#"
source = "github"
runner = "claude"
submission = "github"
label = "rlph"
poll_seconds = 30
worktree_dir = "/tmp/wt"
"#;
        let config = parse_config(toml).unwrap();
        assert_eq!(config.source.as_deref(), Some("github"));
        assert_eq!(config.poll_seconds, Some(30));
    }
test_file_invalid_source_rejected function · rust · L553-L561 (9 LOC)
src/config.rs
    fn test_file_invalid_source_rejected() {
        let tmp = tempfile::tempdir().unwrap();
        let cfg_dir = tmp.path().join(".rlph");
        std::fs::create_dir_all(&cfg_dir).unwrap();
        std::fs::write(cfg_dir.join("config.toml"), r#"source = "jira""#).unwrap();
        let cli = Cli::parse_from(["rlph", "--once"]);
        let err = Config::load_from(&cli, tmp.path()).unwrap_err();
        assert!(err.to_string().contains("unknown source: jira"));
    }
test_file_invalid_runner_rejected function · rust · L564-L572 (9 LOC)
src/config.rs
    fn test_file_invalid_runner_rejected() {
        let tmp = tempfile::tempdir().unwrap();
        let cfg_dir = tmp.path().join(".rlph");
        std::fs::create_dir_all(&cfg_dir).unwrap();
        std::fs::write(cfg_dir.join("config.toml"), r#"runner = "podman""#).unwrap();
        let cli = Cli::parse_from(["rlph", "--once"]);
        let err = Config::load_from(&cli, tmp.path()).unwrap_err();
        assert!(err.to_string().contains("unknown runner: podman"));
    }
test_file_invalid_submission_rejected function · rust · L575-L583 (9 LOC)
src/config.rs
    fn test_file_invalid_submission_rejected() {
        let tmp = tempfile::tempdir().unwrap();
        let cfg_dir = tmp.path().join(".rlph");
        std::fs::create_dir_all(&cfg_dir).unwrap();
        std::fs::write(cfg_dir.join("config.toml"), r#"submission = "gitlab""#).unwrap();
        let cli = Cli::parse_from(["rlph", "--once"]);
        let err = Config::load_from(&cli, tmp.path()).unwrap_err();
        assert!(err.to_string().contains("unknown submission: gitlab"));
    }
test_file_zero_poll_seconds_rejected function · rust · L586-L594 (9 LOC)
src/config.rs
    fn test_file_zero_poll_seconds_rejected() {
        let tmp = tempfile::tempdir().unwrap();
        let cfg_dir = tmp.path().join(".rlph");
        std::fs::create_dir_all(&cfg_dir).unwrap();
        std::fs::write(cfg_dir.join("config.toml"), r#"poll_seconds = 0"#).unwrap();
        let cli = Cli::parse_from(["rlph", "--once"]);
        let err = Config::load_from(&cli, tmp.path()).unwrap_err();
        assert!(err.to_string().contains("poll_seconds must be > 0"));
    }
Methodology: Repobility · https://repobility.com/research/state-of-ai-code-2026/
test_cli_overrides_config function · rust · L604-L630 (27 LOC)
src/config.rs
    fn test_cli_overrides_config() {
        let file = ConfigFile {
            source: Some("github".to_string()),
            runner: Some("claude".to_string()),
            label: Some("file-label".to_string()),
            poll_seconds: Some(120),
            linear: Some(LinearConfigFile {
                team: Some("ENG".to_string()),
                ..Default::default()
            }),
            ..Default::default()
        };
        let cli = Cli::parse_from([
            "rlph",
            "--once",
            "--source",
            "linear",
            "--label",
            "cli-label",
        ]);
        let config = merge(file, &cli).unwrap();
        assert_eq!(config.source, "linear"); // CLI wins
        assert_eq!(config.label, "cli-label"); // CLI wins
        assert_eq!(config.runner, "claude"); // file value kept
        assert_eq!(config.poll_seconds, 120); // file value kept
        assert!(config.once);
    }
test_defaults_applied function · rust · L633-L647 (15 LOC)
src/config.rs
    fn test_defaults_applied() {
        let file = ConfigFile::default();
        let cli = Cli::parse_from(["rlph", "--once"]);
        let config = merge(file, &cli).unwrap();
        assert_eq!(config.source, "github");
        assert_eq!(config.runner, "claude");
        assert_eq!(config.submission, "github");
        assert_eq!(config.label, "rlph");
        assert_eq!(config.poll_seconds, 30);
        assert_eq!(config.agent_binary, "claude");
        assert_eq!(config.agent_model.as_deref(), Some("claude-opus-4-6"));
        assert_eq!(config.agent_effort.as_deref(), Some("high"));
        assert_eq!(config.agent_timeout, Some(600));
        assert_eq!(config.agent_timeout_retries, 2);
    }
test_agent_timeout_overrides_default function · rust · L650-L658 (9 LOC)
src/config.rs
    fn test_agent_timeout_overrides_default() {
        let file = ConfigFile {
            agent_timeout: Some(120),
            ..Default::default()
        };
        let cli = Cli::parse_from(["rlph", "--once", "--agent-timeout", "45"]);
        let config = merge(file, &cli).unwrap();
        assert_eq!(config.agent_timeout, Some(45));
    }
test_load_missing_default_config_falls_back_to_defaults function · rust · L661-L676 (16 LOC)
src/config.rs
    fn test_load_missing_default_config_falls_back_to_defaults() {
        // When no --config is provided and .rlph/config.toml doesn't exist,
        // Config::load should succeed with built-in defaults.
        let tmp = tempfile::tempdir().unwrap();
        let cli = Cli::parse_from(["rlph", "--once"]);
        let config = Config::load_from(&cli, tmp.path()).unwrap();
        assert_eq!(config.source, "github");
        assert_eq!(config.runner, "claude");
        assert_eq!(config.submission, "github");
        assert_eq!(config.label, "rlph");
        assert_eq!(config.poll_seconds, 30);
        assert_eq!(config.agent_binary, "claude");
        assert_eq!(config.agent_model.as_deref(), Some("claude-opus-4-6"));
        assert_eq!(config.agent_effort.as_deref(), Some("high"));
        assert!(config.once);
    }
test_load_missing_default_config_with_cli_overrides function · rust · L679-L687 (9 LOC)
src/config.rs
    fn test_load_missing_default_config_with_cli_overrides() {
        // CLI overrides should still win when default config file is absent.
        let tmp = tempfile::tempdir().unwrap();
        let cli = Cli::parse_from(["rlph", "--once", "--runner", "codex", "--label", "custom"]);
        let config = Config::load_from(&cli, tmp.path()).unwrap();
        assert_eq!(config.runner, "codex");
        assert_eq!(config.label, "custom");
        assert_eq!(config.source, "github"); // default
    }
test_load_explicit_missing_config_errors function · rust · L690-L695 (6 LOC)
src/config.rs
    fn test_load_explicit_missing_config_errors() {
        // When --config points to a missing file, Config::load should fail.
        let cli = Cli::parse_from(["rlph", "--once", "--config", "/nonexistent/config.toml"]);
        let err = Config::load(&cli).unwrap_err();
        assert!(err.to_string().contains("config file not found"));
    }
test_resolve_init_config_uses_file_source_without_linear_section function · rust · L698-L712 (15 LOC)
src/config.rs
    fn test_resolve_init_config_uses_file_source_without_linear_section() {
        let tmp = tempfile::tempdir().unwrap();
        let cfg_dir = tmp.path().join(".rlph");
        std::fs::create_dir_all(&cfg_dir).unwrap();
        std::fs::write(
            cfg_dir.join("config.toml"),
            "source = \"linear\"\nlabel = \"ops\"\n",
        )
        .unwrap();

        let cli = Cli::parse_from(["rlph", "init"]);
        let cfg = resolve_init_config_from(&cli, tmp.path()).unwrap();
        assert_eq!(cfg.source, "linear");
        assert_eq!(cfg.label, "ops");
    }
test_resolve_init_config_cli_overrides_file function · rust · L715-L729 (15 LOC)
src/config.rs
    fn test_resolve_init_config_cli_overrides_file() {
        let tmp = tempfile::tempdir().unwrap();
        let cfg_dir = tmp.path().join(".rlph");
        std::fs::create_dir_all(&cfg_dir).unwrap();
        std::fs::write(
            cfg_dir.join("config.toml"),
            "source = \"github\"\nlabel = \"file\"\n",
        )
        .unwrap();

        let cli = Cli::parse_from(["rlph", "init", "--source", "linear", "--label", "cli"]);
        let cfg = resolve_init_config_from(&cli, tmp.path()).unwrap();
        assert_eq!(cfg.source, "linear");
        assert_eq!(cfg.label, "cli");
    }
Citation: Repobility (2026). State of AI-Generated Code. https://repobility.com/research/
test_resolve_init_config_defaults_when_file_missing function · rust · L732-L738 (7 LOC)
src/config.rs
    fn test_resolve_init_config_defaults_when_file_missing() {
        let tmp = tempfile::tempdir().unwrap();
        let cli = Cli::parse_from(["rlph", "init"]);
        let cfg = resolve_init_config_from(&cli, tmp.path()).unwrap();
        assert_eq!(cfg.source, "github");
        assert_eq!(cfg.label, "rlph");
    }
test_cli_invalid_source_rejected function · rust · L741-L746 (6 LOC)
src/config.rs
    fn test_cli_invalid_source_rejected() {
        let tmp = tempfile::tempdir().unwrap();
        let cli = Cli::parse_from(["rlph", "--once", "--source", "jira"]);
        let err = Config::load_from(&cli, tmp.path()).unwrap_err();
        assert!(err.to_string().contains("unknown source: jira"));
    }
test_cli_invalid_runner_rejected function · rust · L749-L754 (6 LOC)
src/config.rs
    fn test_cli_invalid_runner_rejected() {
        let tmp = tempfile::tempdir().unwrap();
        let cli = Cli::parse_from(["rlph", "--once", "--runner", "bogus"]);
        let err = Config::load_from(&cli, tmp.path()).unwrap_err();
        assert!(err.to_string().contains("unknown runner: bogus"));
    }
test_cli_invalid_submission_rejected function · rust · L757-L762 (6 LOC)
src/config.rs
    fn test_cli_invalid_submission_rejected() {
        let tmp = tempfile::tempdir().unwrap();
        let cli = Cli::parse_from(["rlph", "--once", "--submission", "gitlab"]);
        let err = Config::load_from(&cli, tmp.path()).unwrap_err();
        assert!(err.to_string().contains("unknown submission: gitlab"));
    }
test_cli_zero_poll_seconds_rejected function · rust · L765-L770 (6 LOC)
src/config.rs
    fn test_cli_zero_poll_seconds_rejected() {
        let tmp = tempfile::tempdir().unwrap();
        let cli = Cli::parse_from(["rlph", "--once", "--poll-seconds", "0"]);
        let err = Config::load_from(&cli, tmp.path()).unwrap_err();
        assert!(err.to_string().contains("poll_seconds must be > 0"));
    }
test_codex_runner_accepted function · rust · L773-L778 (6 LOC)
src/config.rs
    fn test_codex_runner_accepted() {
        let tmp = tempfile::tempdir().unwrap();
        let cli = Cli::parse_from(["rlph", "--once", "--runner", "codex"]);
        let config = Config::load_from(&cli, tmp.path()).unwrap();
        assert_eq!(config.runner, "codex");
    }
test_codex_runner_defaults_binary_to_codex function · rust · L781-L787 (7 LOC)
src/config.rs
    fn test_codex_runner_defaults_binary_to_codex() {
        let tmp = tempfile::tempdir().unwrap();
        let cli = Cli::parse_from(["rlph", "--once", "--runner", "codex"]);
        let config = Config::load_from(&cli, tmp.path()).unwrap();
        assert_eq!(config.agent_binary, "codex");
        assert_eq!(config.agent_model.as_deref(), Some("gpt-5.3-codex"));
    }
test_codex_runner_binary_override function · rust · L790-L802 (13 LOC)
src/config.rs
    fn test_codex_runner_binary_override() {
        let tmp = tempfile::tempdir().unwrap();
        let cli = Cli::parse_from([
            "rlph",
            "--once",
            "--runner",
            "codex",
            "--agent-binary",
            "/opt/codex",
        ]);
        let config = Config::load_from(&cli, tmp.path()).unwrap();
        assert_eq!(config.agent_binary, "/opt/codex");
    }
Repobility's GitHub App fixes findings like these · https://github.com/apps/repobility-bot
test_old_runner_bare_rejected function · rust · L805-L810 (6 LOC)
src/config.rs
    fn test_old_runner_bare_rejected() {
        let tmp = tempfile::tempdir().unwrap();
        let cli = Cli::parse_from(["rlph", "--once", "--runner", "bare"]);
        let err = Config::load_from(&cli, tmp.path()).unwrap_err();
        assert!(err.to_string().contains("unknown runner: bare"));
    }
test_old_runner_docker_rejected function · rust · L813-L818 (6 LOC)
src/config.rs
    fn test_old_runner_docker_rejected() {
        let tmp = tempfile::tempdir().unwrap();
        let cli = Cli::parse_from(["rlph", "--once", "--runner", "docker"]);
        let err = Config::load_from(&cli, tmp.path()).unwrap_err();
        assert!(err.to_string().contains("unknown runner: docker"));
    }
test_review_phases_parsed_from_toml function · rust · L821-L855 (35 LOC)
src/config.rs
    fn test_review_phases_parsed_from_toml() {
        let tmp = tempfile::tempdir().unwrap();
        let cfg_dir = tmp.path().join(".rlph");
        std::fs::create_dir_all(&cfg_dir).unwrap();
        std::fs::write(
            cfg_dir.join("config.toml"),
            r#"
[[review_phases]]
name = "correctness"
prompt = "correctness-review"

[[review_phases]]
name = "security"
prompt = "security-review"
agent_model = "claude-opus-4-6"
agent_effort = "high"
"#,
        )
        .unwrap();
        let cli = Cli::parse_from(["rlph", "--once"]);
        let config = Config::load_from(&cli, tmp.path()).unwrap();
        assert_eq!(config.review_phases.len(), 2);
        assert_eq!(config.review_phases[0].name, "correctness");
        assert_eq!(config.review_phases[0].prompt, "correctness-review");
        assert_eq!(config.review_phases[0].runner, "claude"); // falls back to global
        assert_eq!(config.review_phases[1].name, "security");
        assert_eq!(
            config.revie
test_review_phases_duplicate_name_rejected function · rust · L858-L878 (21 LOC)
src/config.rs
    fn test_review_phases_duplicate_name_rejected() {
        let tmp = tempfile::tempdir().unwrap();
        let cfg_dir = tmp.path().join(".rlph");
        std::fs::create_dir_all(&cfg_dir).unwrap();
        std::fs::write(
            cfg_dir.join("config.toml"),
            r#"
[[review_phases]]
name = "check"
prompt = "check-review"

[[review_phases]]
name = "check"
prompt = "other-review"
"#,
        )
        .unwrap();
        let cli = Cli::parse_from(["rlph", "--once"]);
        let err = Config::load_from(&cli, tmp.path()).unwrap_err();
        assert!(err.to_string().contains("duplicate review phase name"));
    }
test_review_aggregate_and_fix_parsed function · rust · L881-L909 (29 LOC)
src/config.rs
    fn test_review_aggregate_and_fix_parsed() {
        let tmp = tempfile::tempdir().unwrap();
        let cfg_dir = tmp.path().join(".rlph");
        std::fs::create_dir_all(&cfg_dir).unwrap();
        std::fs::write(
            cfg_dir.join("config.toml"),
            r#"
[[review_phases]]
name = "check"
prompt = "check-review"

[review_aggregate]
prompt = "my-aggregate"
agent_model = "claude-opus-4-6"

[review_fix]
prompt = "my-fix"
"#,
        )
        .unwrap();
        let cli = Cli::parse_from(["rlph", "--once"]);
        let config = Config::load_from(&cli, tmp.path()).unwrap();
        assert_eq!(config.review_aggregate.prompt, "my-aggregate");
        assert_eq!(
            config.review_aggregate.agent_model.as_deref(),
            Some("claude-opus-4-6")
        );
        assert_eq!(config.review_fix.prompt, "my-fix");
    }
test_review_aggregate_defaults function · rust · L912-L920 (9 LOC)
src/config.rs
    fn test_review_aggregate_defaults() {
        let tmp = tempfile::tempdir().unwrap();
        let cli = Cli::parse_from(["rlph", "--once"]);
        let config = Config::load_from(&cli, tmp.path()).unwrap();
        assert_eq!(config.review_aggregate.prompt, "review-aggregate");
        assert_eq!(config.review_fix.prompt, "review-fix");
        assert_eq!(config.review_aggregate.runner, "claude");
        assert_eq!(config.review_fix.runner, "claude");
    }
test_default_review_phases_provided function · rust · L923-L931 (9 LOC)
src/config.rs
    fn test_default_review_phases_provided() {
        let tmp = tempfile::tempdir().unwrap();
        let cli = Cli::parse_from(["rlph", "--once"]);
        let config = Config::load_from(&cli, tmp.path()).unwrap();
        assert_eq!(config.review_phases.len(), 3);
        assert_eq!(config.review_phases[0].name, "correctness");
        assert_eq!(config.review_phases[1].name, "security");
        assert_eq!(config.review_phases[2].name, "style");
    }
test_review_phase_empty_name_rejected function · rust · L934-L950 (17 LOC)
src/config.rs
    fn test_review_phase_empty_name_rejected() {
        let tmp = tempfile::tempdir().unwrap();
        let cfg_dir = tmp.path().join(".rlph");
        std::fs::create_dir_all(&cfg_dir).unwrap();
        std::fs::write(
            cfg_dir.join("config.toml"),
            r#"
[[review_phases]]
name = ""
prompt = "check-review"
"#,
        )
        .unwrap();
        let cli = Cli::parse_from(["rlph", "--once"]);
        let err = Config::load_from(&cli, tmp.path()).unwrap_err();
        assert!(err.to_string().contains("name must not be empty"));
    }
Generated by Repobility's multi-pass static-analysis pipeline (https://repobility.com)
test_review_phase_empty_prompt_rejected function · rust · L953-L969 (17 LOC)
src/config.rs
    fn test_review_phase_empty_prompt_rejected() {
        let tmp = tempfile::tempdir().unwrap();
        let cfg_dir = tmp.path().join(".rlph");
        std::fs::create_dir_all(&cfg_dir).unwrap();
        std::fs::write(
            cfg_dir.join("config.toml"),
            r#"
[[review_phases]]
name = "check"
prompt = ""
"#,
        )
        .unwrap();
        let cli = Cli::parse_from(["rlph", "--once"]);
        let err = Config::load_from(&cli, tmp.path()).unwrap_err();
        assert!(err.to_string().contains("prompt must not be empty"));
    }
test_review_phase_invalid_runner_rejected function · rust · L972-L989 (18 LOC)
src/config.rs
    fn test_review_phase_invalid_runner_rejected() {
        let tmp = tempfile::tempdir().unwrap();
        let cfg_dir = tmp.path().join(".rlph");
        std::fs::create_dir_all(&cfg_dir).unwrap();
        std::fs::write(
            cfg_dir.join("config.toml"),
            r#"
[[review_phases]]
name = "check"
prompt = "check-review"
runner = "podman"
"#,
        )
        .unwrap();
        let cli = Cli::parse_from(["rlph", "--once"]);
        let err = Config::load_from(&cli, tmp.path()).unwrap_err();
        assert!(err.to_string().contains("unknown runner 'podman'"));
    }
test_review_phase_inherits_global_runner function · rust · L992-L1011 (20 LOC)
src/config.rs
    fn test_review_phase_inherits_global_runner() {
        let tmp = tempfile::tempdir().unwrap();
        let cfg_dir = tmp.path().join(".rlph");
        std::fs::create_dir_all(&cfg_dir).unwrap();
        std::fs::write(
            cfg_dir.join("config.toml"),
            r#"
runner = "codex"

[[review_phases]]
name = "check"
prompt = "check-review"
"#,
        )
        .unwrap();
        let cli = Cli::parse_from(["rlph", "--once"]);
        let config = Config::load_from(&cli, tmp.path()).unwrap();
        assert_eq!(config.review_phases[0].runner, "codex");
        assert_eq!(config.review_phases[0].agent_binary, "codex");
    }
page 1 / 7next ›