• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

xd009642 / tarpaulin / #692

24 Oct 2025 07:10PM UTC coverage: 84.27% (+8.9%) from 75.356%
#692

push

xd009642
Release 0.34.1

44 of 47 new or added lines in 4 files covered. (93.62%)

34 existing lines in 7 files now uncovered.

4602 of 5461 relevant lines covered (84.27%)

252235.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

79.25
/src/config/parse.rs
1
use crate::config::types::*;
2
use crate::path_utils::fix_unc_path;
3
#[cfg(feature = "coveralls")]
4
use coveralls_api::CiService;
5
use serde::de::{self, Deserializer};
6
use std::env;
7
use std::fmt;
8
use std::fs::create_dir_all;
9
use std::path::PathBuf;
10
use std::str::FromStr;
11
use tracing::error;
12

13
pub(super) fn globs_from_excluded(strs: &[String]) -> Vec<glob::Pattern> {
5✔
14
    let mut files = vec![];
10✔
15
    for temp_str in strs {
19✔
16
        if let Ok(glob) = glob::Pattern::new(temp_str) {
21✔
17
            files.push(glob);
14✔
18
        } else {
19
            error!("Ignoring invalid glob pattern: '{}'", temp_str);
×
20
        }
21
    }
22
    files
5✔
23
}
24

25
pub(super) fn process_manifest(
21✔
26
    opt_manifest_path: Option<PathBuf>,
27
    opt_root: Option<PathBuf>,
28
) -> PathBuf {
29
    if let Some(path) = opt_manifest_path {
21✔
UNCOV
30
        return canonicalize_path(path);
×
31
    }
32

33
    let mut manifest = env::current_dir().unwrap();
63✔
34
    if let Some(path) = opt_root {
47✔
35
        manifest.push(path);
26✔
36
    }
37
    manifest.push("Cargo.toml");
42✔
38
    canonicalize_path(manifest)
42✔
39
}
40

41
pub(super) fn default_manifest() -> PathBuf {
233✔
42
    let mut manifest = env::current_dir().unwrap();
699✔
43
    manifest.push("Cargo.toml");
466✔
44
    fix_unc_path(&manifest.canonicalize().unwrap_or(manifest))
699✔
45
}
46

47
pub(super) fn process_target_dir(opt_path: Option<PathBuf>) -> Option<PathBuf> {
21✔
48
    let path = if let Some(path) = opt_path {
21✔
UNCOV
49
        path
×
50
    } else if let Some(envvar) = env::var_os("CARGO_TARPAULIN_TARGET_DIR") {
21✔
UNCOV
51
        PathBuf::from(envvar)
×
52
    } else {
53
        return None;
21✔
54
    };
55

56
    if !path.exists() {
×
57
        let _ = create_dir_all(&path);
×
58
    }
UNCOV
59
    Some(canonicalize_path(path))
×
60
}
61

62
pub(super) fn canonicalize_paths(paths: Vec<PathBuf>) -> Vec<PathBuf> {
21✔
63
    paths.into_iter().map(canonicalize_path).collect()
84✔
64
}
65

66
pub(super) fn canonicalize_path(mut path: PathBuf) -> PathBuf {
22✔
67
    if path.is_relative() {
23✔
68
        path = env::current_dir()
4✔
69
            .unwrap()
3✔
70
            .canonicalize()
3✔
71
            .unwrap()
3✔
72
            .join(&path);
2✔
73
        path = fix_unc_path(&path);
2✔
74
    }
75
    path
22✔
76
}
77

78
#[cfg(feature = "coveralls")]
79
pub fn deserialize_ci_server<'de, D>(d: D) -> Result<Option<CiService>, D::Error>
2✔
80
where
81
    D: Deserializer<'de>,
82
{
83
    struct CiServerVisitor;
84

85
    impl<'de> de::Visitor<'de> for CiServerVisitor {
×
86
        type Value = Option<CiService>;
87

88
        fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
×
89
            formatter.write_str("A string containing the ci-service name")
×
90
        }
91

92
        fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
2✔
93
        where
94
            E: de::Error,
95
        {
96
            if v.is_empty() {
4✔
97
                Ok(None)
×
98
            } else {
99
                Ok(Some(Ci::from_str(v).unwrap().0))
4✔
100
            }
101
        }
102
    }
103

104
    d.deserialize_any(CiServerVisitor)
6✔
105
}
106

107
#[cfg(test)]
108
mod tests {
109
    use super::*;
110

111
    #[test]
112
    fn path_canonicalization() {
1✔
113
        let path = PathBuf::from("src/lib.rs");
2✔
114
        assert_eq!(
1✔
115
            canonicalize_path(path),
2✔
116
            PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("src/lib.rs")
1✔
117
        );
118
    }
119
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc