Commit db45867a authored by Wohlgemuth, Jason's avatar Wohlgemuth, Jason
Browse files

feat: Clear lint issues and generate coverage

parent fdf0a2ec
Loading
Loading
Loading
Loading
Loading
+79 −89
Original line number Diff line number Diff line
TN:
SF:/root/dev/pipe/pipe-cli/src/commands/check/checks/is_valid_python_module/mod.rs
SF:/root/dev/re/pipe/pipe-cli/src/commands/check/checks/is_valid_python_module/mod.rs
FN:16,run
FNF:1
FNDA:0,run
@@ -9,7 +9,7 @@ LF:2
LH:0
end_of_record
TN:
SF:/root/dev/pipe/pipe-cli/src/commands/check/checks/template/mod.rs
SF:/root/dev/re/pipe/pipe-cli/src/commands/check/checks/template/mod.rs
FN:6,_run
FNF:1
FNDA:0,_run
@@ -19,7 +19,7 @@ LF:2
LH:0
end_of_record
TN:
SF:/root/dev/pipe/pipe-cli/src/commands/check/mod.rs
SF:/root/dev/re/pipe/pipe-cli/src/commands/check/mod.rs
FN:22,run
FNF:1
FNDA:0,run
@@ -51,6 +51,7 @@ DA:75,0
DA:76,0
DA:77,0
DA:78,0
DA:79,0
DA:81,0
DA:84,0
DA:90,0
@@ -78,6 +79,7 @@ DA:118,0
DA:119,0
DA:120,0
DA:121,0
DA:122,0
DA:124,0
DA:125,0
DA:126,0
@@ -91,11 +93,12 @@ DA:137,0
DA:138,0
DA:140,0
DA:141,0
LF:68
DA:143,0
LF:71
LH:0
end_of_record
TN:
SF:/root/dev/pipe/pipe-cli/src/commands/doctor/mod.rs
SF:/root/dev/re/pipe/pipe-cli/src/commands/doctor/mod.rs
FN:6,run
FNF:1
FNDA:0,run
@@ -104,7 +107,7 @@ LF:1
LH:0
end_of_record
TN:
SF:/root/dev/pipe/pipe-cli/src/commands/run/mod.rs
SF:/root/dev/re/pipe/pipe-cli/src/commands/run/mod.rs
FN:16,run
FNF:1
FNDA:0,run
@@ -134,10 +137,6 @@ DA:61,0
DA:62,0
DA:64,0
DA:65,0
DA:66,0
DA:67,0
DA:68,0
DA:69,0
DA:72,0
DA:73,0
DA:74,0
@@ -152,11 +151,12 @@ DA:87,0
DA:90,0
DA:91,0
DA:96,0
LF:44
DA:98,0
LF:41
LH:0
end_of_record
TN:
SF:/root/dev/pipe/pipe-cli/src/main.rs
SF:/root/dev/re/pipe/pipe-cli/src/main.rs
FN:26,main
FNF:1
FNDA:0,main
@@ -165,21 +165,10 @@ DA:27,0
DA:28,0
DA:29,0
DA:31,0
DA:32,0
DA:33,0
DA:34,0
DA:35,0
DA:36,0
DA:38,0
DA:42,0
DA:43,0
DA:44,0
DA:45,0
DA:46,0
DA:47,0
DA:50,0
DA:51,0
DA:52,0
DA:56,0
DA:57,0
DA:68,0
@@ -190,11 +179,11 @@ DA:87,0
DA:88,0
DA:89,0
DA:91,0
LF:30
LF:19
LH:0
end_of_record
TN:
SF:/root/dev/pipe/pipe-cli/src/reporters/console/mod.rs
SF:/root/dev/re/pipe/pipe-cli/src/reporters/console/mod.rs
FN:5,run
FN:43,print_pass
FN:52,print_fail
@@ -221,6 +210,7 @@ DA:29,0
DA:30,0
DA:37,0
DA:38,0
DA:40,0
DA:43,0
DA:44,0
DA:45,0
@@ -231,11 +221,11 @@ DA:53,0
DA:54,0
DA:57,0
DA:59,0
LF:29
LF:30
LH:0
end_of_record
TN:
SF:/root/dev/pipe/pipe-cli/src/reporters/json/mod.rs
SF:/root/dev/re/pipe/pipe-cli/src/reporters/json/mod.rs
FN:10,run
FNF:1
FNDA:0,run
@@ -273,16 +263,17 @@ LF:30
LH:0
end_of_record
TN:
SF:/root/dev/pipe/pipe-cli/src/reporters/stdout/mod.rs
SF:/root/dev/re/pipe/pipe-cli/src/reporters/stdout/mod.rs
FN:5,run
FNF:1
FNDA:0,run
DA:5,0
LF:1
DA:6,0
LF:2
LH:0
end_of_record
TN:
SF:/root/dev/pipe/pipe-lib/src/config.rs
SF:/root/dev/re/pipe/pipe-lib/src/config.rs
FN:119,Config::get_environment_variables
FN:139,Config::get_inputs
FN:169,Config::get_module_list
@@ -340,8 +331,8 @@ DA:160,1
DA:161,0
DA:166,0
DA:169,1
DA:170,1
DA:173,3
DA:170,2
DA:173,2
DA:175,2
DA:184,0
DA:185,0
@@ -576,7 +567,7 @@ LF:262
LH:42
end_of_record
TN:
SF:/root/dev/pipe/pipe-lib/src/lib.rs
SF:/root/dev/re/pipe/pipe-lib/src/lib.rs
FN:81,<impl PartialEq for Details>::eq
FN:88,<impl Deref for PyProjectToml>::deref
FN:93,PyProjectToml::read
@@ -617,7 +608,7 @@ LF:25
LH:20
end_of_record
TN:
SF:/root/dev/pipe/pipe-lib/src/script.rs
SF:/root/dev/re/pipe/pipe-lib/src/script.rs
FN:300,Command::test
FN:324,EnvironmentValue::formatted_prefix
FN:329,EnvironmentValue::from_value
@@ -695,7 +686,7 @@ FNDA:0,Script::with_envs
FNDA:1,Script::with_virtual_environment
FNDA:1,ScriptTemplate::from_path
FNDA:0,ScriptTemplate::resolve_python_virtual_environment
FNDA:1,StringTemplate::new
FNDA:2,StringTemplate::new
FNDA:1,StringTemplate::expand
FNDA:1,StringTemplate::get_variable
FNDA:2,StringTemplate::is_handlebars
@@ -705,9 +696,9 @@ DA:300,1
DA:301,2
DA:302,1
DA:303,2
DA:304,3
DA:306,2
DA:307,1
DA:304,5
DA:306,4
DA:307,2
DA:310,0
DA:311,0
DA:316,2
@@ -738,9 +729,9 @@ DA:355,0
DA:357,0
DA:359,1
DA:360,1
DA:361,1
DA:362,3
DA:363,3
DA:361,2
DA:362,2
DA:363,2
DA:364,2
DA:365,1
DA:369,0
@@ -756,6 +747,7 @@ DA:384,0
DA:385,0
DA:386,0
DA:390,0
DA:391,0
DA:393,0
DA:397,2
DA:398,2
@@ -770,8 +762,9 @@ DA:409,1
DA:410,1
DA:411,1
DA:412,0
DA:418,3
DA:419,3
DA:414,2
DA:418,2
DA:419,2
DA:421,2
DA:422,2
DA:424,2
@@ -800,9 +793,9 @@ DA:468,1
DA:469,1
DA:470,1
DA:487,1
DA:488,1
DA:491,3
DA:492,2
DA:488,2
DA:491,2
DA:492,1
DA:493,2
DA:494,1
DA:495,1
@@ -810,15 +803,12 @@ DA:497,2
DA:501,1
DA:502,1
DA:522,1
DA:523,1
DA:526,3
DA:527,2
DA:523,2
DA:526,2
DA:527,1
DA:528,2
DA:529,1
DA:530,1
DA:531,1
DA:532,3
DA:533,1
DA:529,2
DA:532,2
DA:534,1
DA:536,2
DA:540,1
@@ -854,23 +844,23 @@ DA:617,1
DA:630,1
DA:631,1
DA:632,3
DA:633,1
DA:636,3
DA:638,1
DA:640,3
DA:636,2
DA:638,2
DA:640,2
DA:643,3
DA:644,1
DA:645,1
DA:646,1
DA:648,1
DA:650,1
DA:651,1
DA:651,2
DA:652,1
DA:653,1
DA:655,1
DA:653,2
DA:655,2
DA:656,2
DA:657,1
DA:657,2
DA:660,1
DA:661,1
DA:661,2
DA:662,1
DA:663,1
DA:664,1
@@ -880,8 +870,8 @@ DA:668,0
DA:669,0
DA:672,2
DA:673,1
DA:675,1
DA:677,1
DA:675,3
DA:677,3
DA:678,1
DA:679,1
DA:680,2
@@ -893,7 +883,7 @@ DA:688,0
DA:689,0
DA:692,1
DA:693,1
DA:695,1
DA:695,3
DA:700,0
DA:701,0
DA:702,0
@@ -931,22 +921,22 @@ DA:758,0
DA:762,1
DA:763,1
DA:764,1
DA:765,2
DA:766,2
DA:767,2
DA:765,3
DA:766,3
DA:767,3
DA:768,1
DA:769,3
DA:769,9
DA:770,2
DA:771,2
DA:771,1
DA:772,1
DA:773,1
DA:774,1
DA:779,4
DA:780,1
DA:779,2
DA:780,2
DA:782,0
DA:783,0
DA:786,2
DA:787,1
DA:787,2
DA:788,2
DA:789,2
DA:792,2
@@ -1006,10 +996,10 @@ DA:915,0
DA:920,0
DA:921,0
DA:922,0
DA:932,1
DA:932,2
DA:934,2
DA:941,1
DA:942,3
DA:942,5
DA:943,3
DA:948,1
DA:949,2
@@ -1027,24 +1017,24 @@ DA:1013,1
DA:1014,2
DA:1015,1
DA:1016,0
DA:1018,3
DA:1018,4
DA:1019,1
DA:1023,1
DA:1024,1
DA:1025,2
DA:1026,1
DA:1027,2
DA:1028,4
DA:1031,2
DA:1033,3
DA:1035,5
DA:1036,3
DA:1028,5
DA:1031,1
DA:1033,2
DA:1035,4
DA:1036,2
DA:1039,0
LF:339
LH:186
LF:338
LH:184
end_of_record
TN:
SF:/root/dev/pipe/pipe-lib/src/util.rs
SF:/root/dev/re/pipe/pipe-lib/src/util.rs
FN:25,Label::dry_run
FN:29,Label::invalid
FN:32,Label::fmt_invalid
@@ -1112,8 +1102,8 @@ DA:52,0
DA:54,1
DA:55,1
DA:57,1
DA:58,1
DA:59,1
DA:58,2
DA:59,2
DA:61,0
DA:62,0
DA:63,0
@@ -1161,7 +1151,7 @@ DA:148,1
DA:149,3
DA:150,2
DA:151,1
DA:152,3
DA:152,6
DA:164,1
DA:166,0
DA:168,1
@@ -1202,7 +1192,7 @@ DA:276,2
DA:277,1
DA:280,1
DA:282,1
DA:283,4
DA:283,3
DA:285,1
DA:286,4
LF:117
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ pub fn run(
                    .skip_verify_requirements(cli_skip_verify_requirements)
                    .build(),
            };
            debug!("=> {} Run configuration options = {}", Label::using(), format!("{:#?}", options).dimmed());
            debug!("=> {} Run configuration options = {}", Label::using(), format!("{options:#?}").dimmed());
            let config = cfg
                .with_options(options.clone())
                .verify_requirements()
+2 −2
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ fn print_pass(value: String, minimal: bool) {
        static CHECKMARK: Emoji<'_, '_> = Emoji("✔", ":-)");
        format!("\t{} {}", style(CHECKMARK).green(), value)
    };
    println!("{}", output);
    println!("{output}");
}
fn print_fail(value: String, err: String, minimal: bool) {
    let output = if minimal {
@@ -56,5 +56,5 @@ fn print_fail(value: String, err: String, minimal: bool) {
        const RED_X: Emoji<'_, '_> = Emoji("✘", ":-(");
        format!("\t{} {} {}", style(RED_X).red(), value, style(err).red())
    };
    println!("{}", output)
    println!("{output}")
}
+23 −25
Original line number Diff line number Diff line
@@ -54,13 +54,13 @@ fn test_command() {

#[test]
fn test_config_get_inputs() {
    match Config::read(PathBuf::from(format!("{}/config.json", FIXTURES))) {
    match Config::read(PathBuf::from(format!("{FIXTURES}/config.json"))) {
        | Some(config) => {
            assert_eq!(config.get_inputs(), Some(to_string(vec!["input_01", "input_02", "input_03"])));
        }
        | None => panic!("Cannot read config in get_input test"),
    }
    match Config::read(PathBuf::from(format!("{}/config_with_path_input.json", FIXTURES))) {
    match Config::read(PathBuf::from(format!("{FIXTURES}/config_with_path_input.json"))) {
        | Some(config) => {
            let mut inputs = config
                .get_inputs()
@@ -77,7 +77,7 @@ fn test_config_get_inputs() {

#[test]
fn test_config_get_module_list() {
    let path = format!("{}/config.json", FIXTURES);
    let path = format!("{FIXTURES}/config.json");
    match Config::read(PathBuf::from(path)) {
        | Some(config) => {
            let expected = "local_binary_module,local_python_script_module,remote_python_script_module";
@@ -89,12 +89,12 @@ fn test_config_get_module_list() {

#[test]
fn test_config_read() {
    let path = format!("{}/config.json", FIXTURES);
    let path = format!("{FIXTURES}/config.json");
    // Load variables into configuration (JSON or YAML)
    let config = Config::read(PathBuf::from(path));
    assert_eq!(config.clone().unwrap().variables.clone().unwrap().get("ANSWER").unwrap(), 42);
    assert_eq!(config.unwrap().modules.len(), 3);
    let path = format!("{}/config.yaml", FIXTURES);
    let path = format!("{FIXTURES}/config.yaml");
    let config = Config::read(PathBuf::from(path));
    assert_eq!(config.clone().unwrap().variables.clone().unwrap().get("ANSWER").unwrap(), 42);
    assert_eq!(config.unwrap().modules.len(), 3);
@@ -103,7 +103,7 @@ fn test_config_read() {
#[test]
fn test_config_read_json() {
    // Load variables into configuration from JSON file
    let path = format!("{}/config.json", FIXTURES);
    let path = format!("{FIXTURES}/config.json");
    let config = Config::read_json(PathBuf::from(path)).expect("=> [ERROR] Cannot import config in tests");
    assert_eq!(config.variables.clone().unwrap().get("ANSWER").unwrap(), 42);
    assert_eq!(config.modules.len(), 3);
@@ -112,7 +112,7 @@ fn test_config_read_json() {
#[test]
fn test_config_read_yaml() {
    // Load variables into configuration from YAML file
    let path = format!("{}/config.yaml", FIXTURES);
    let path = format!("{FIXTURES}/config.yaml");
    let config = Config::read_yaml(PathBuf::from(path)).expect("=> [ERROR] Cannot import config in tests");
    assert_eq!(config.variables.clone().unwrap().get("ANSWER").unwrap(), 42);
    assert_eq!(config.modules.len(), 3);
@@ -198,7 +198,7 @@ fn test_get_conda_environment_list() {

#[test]
fn test_get_conda_environment_name() {
    let path = format!("{}/environment.yml", FIXTURES);
    let path = format!("{FIXTURES}/environment.yml");
    let manifest_path = PathBuf::from(path);
    assert!(get_conda_environment_name(manifest_path)
        .unwrap()
@@ -290,7 +290,7 @@ fn test_path_to_string() {

#[test]
fn test_read_pyproject_toml() {
    let path = format!("{}/pyproject.toml", FIXTURES);
    let path = format!("{FIXTURES}/pyproject.toml");
    match PyProjectToml::read(PathBuf::from(path)) {
        | Ok(pyproject) => {
            match &pyproject.project {
@@ -311,18 +311,18 @@ fn test_semantic_version() {
    assert_eq!(version.major, 1);
    assert_eq!(version.minor, 2);
    assert_eq!(version.patch, 3);
    assert_eq!(format!("{}", version), "1.2.3");
    assert_eq!(format!("{version}"), "1.2.3");
    let default = SemanticVersion::init().build();
    assert_eq!(default.major, 0);
    assert_eq!(default.minor, 0);
    assert_eq!(default.patch, 0);
    assert_eq!(format!("{}", default), "0.0.0");
    assert_eq!(format!("{default}"), "0.0.0");
}

#[test]
fn test_script() {
    let script = Script::init().build();
    println!("{:?}", script);
    println!("{script:?}");
    assert_eq!(script.command.name, "".to_string());
    assert_eq!(script.command.virtual_environment, None);
    assert!(script.arguments.is_empty());
@@ -373,8 +373,7 @@ fn test_script_expand_arguments() {
            .with_virtual_environment(Some(environment.clone()))
            .to_string(),
        format!(
            "conda run --name {} --no-capture-output python -m lib --input /path/to/input --output /path/to/output",
            environment
            "conda run --name {environment} --no-capture-output python -m lib --input /path/to/input --output /path/to/output"
        )
    );
    assert_eq!(
@@ -424,8 +423,7 @@ fn test_script_expand_arguments_from() {
            .with_virtual_environment(Some(environment.clone()))
            .to_string(),
        format!(
            "conda run --name {} --no-capture-output python -m lib --input FOO --output BAR",
            environment
            "conda run --name {environment} --no-capture-output python -m lib --input FOO --output BAR"
        )
    );
    assert_eq!(
@@ -463,28 +461,28 @@ fn test_script_expand_arguments_from() {
#[test]
fn test_script_from_template() {
    // "shell" format arguments
    let path = PathBuf::from(format!("{}/template.json", FIXTURES));
    let path = PathBuf::from(format!("{FIXTURES}/template.json"));
    let script = Script::from_path(path);
    let expected_value: Vec<String> = to_string(vec!["-m", "lib", "--input", "{{INPUT_DIRECTORY}}", "--output", "{{OUTPUT_DIRECTORY}}"]);
    assert_eq!(script.command.name, "python");
    assert_eq!(script.arguments, expected_value);
    // "exec" format arguments
    let path = PathBuf::from(format!("{}/template_exec.json", FIXTURES));
    let path = PathBuf::from(format!("{FIXTURES}/template_exec.json"));
    let script = Script::from_path(path);
    let expected = "conda run --name base --no-capture-output python -m lib --input {{INPUT_DIRECTORY}} --output {{OUTPUT_DIRECTORY}}";
    assert_eq!(format!("{}", script), expected);
    assert_eq!(format!("{script}"), expected);
    assert_eq!(script.command.name, "python");
    assert_eq!(script.arguments, expected_value);
    // Pixi virtual environment manager
    let path = PathBuf::from(format!("{}/template_pixi.json", FIXTURES));
    let path = PathBuf::from(format!("{FIXTURES}/template_pixi.json"));
    let script = Script::from_path(path);
    let expected = "pixi run --environment cuda python -m lib --input {{INPUT_DIRECTORY}} --output {{OUTPUT_DIRECTORY}}";
    assert_eq!(format!("{}", script), expected);
    assert_eq!(format!("{script}"), expected);
    // Docker + Pixi
    let path = PathBuf::from(format!("{}/template_docker_pixi.json", FIXTURES));
    let path = PathBuf::from(format!("{FIXTURES}/template_docker_pixi.json"));
    let script = Script::from_path(path);
    let expected = "docker exec CONTAINER pixi run --environment ENVIRONMENT python -m lib --method {{METHOD}} --profile {{PROFILE}}";
    assert_eq!(format!("{}", script), expected);
    assert_eq!(format!("{script}"), expected);
}

#[test]
@@ -496,7 +494,7 @@ fn test_script_get_arguments() {
    let arguments = to_string(vec!["hello", "world"]);
    let script = Script::init().command(command).arguments(arguments).build();
    // Docker runtime (default)
    assert_eq!(format!("{}", script), "echo hello world");
    assert_eq!(format!("{script}"), "echo hello world");
    assert_eq!(
        format!("{}", script.clone().with_virtual_environment(Some(virtual_environment.clone()))),
        "conda run --name base --no-capture-output echo hello world"
@@ -552,7 +550,7 @@ fn test_script_run() {
        let script = Script::init().command(command).build();
        let output = script.with_current_dir("/root".to_string()).run();
        assert_eq!(&output, &vec!["/root".to_string()]);
        let path = PathBuf::from(format!("{}/template_run.json", FIXTURES));
        let path = PathBuf::from(format!("{FIXTURES}/template_run.json"));
        let script = Script::from_path(path);
        assert_eq!(script.run(), vec!["hello world".to_string()]);
    }
+2 −2
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ impl Label {
    }
    pub fn fmt_fail(value: &str) -> String {
        let style = Style::new().white().on_red();
        format!(" ✗ {} ", value).style(style).to_string()
        format!(" ✗ {value} ").style(style).to_string()
    }
    pub fn found() -> Styled<&'static &'static str> {
        let style = Style::new().green().on_default_color();
@@ -172,7 +172,7 @@ pub fn get_conda_environment_name(path: PathBuf) -> Option<String> {
pub fn get_checksum(path: PathBuf) -> String {
    if let Ok(content) = read_file(path) {
        let hash = Sha256::digest(content);
        format!("{:x}", hash)
        format!("{hash:x}")
    } else {
        unreachable!()
    }