1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Organization source provenance and coverage.
use alloc::collections::BTreeMap;
use alloc::string::String;
use alloc::vec::Vec;
/// Organization source provenance and analysis coverage.
#[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize)]
pub struct OrganizationReport {
/// GitHub organization login.
pub name: String,
/// Repositories accessible during enumeration.
pub repositories: Vec<OrganizationRepository>,
/// Cargo packages discovered in repository snapshots.
pub packages: Vec<OrganizationPackage>,
/// Package indices for each physical file present in findings.
pub file_packages: BTreeMap<String, Vec<usize>>,
/// Whether the accessible corpus was fully analyzed.
pub coverage: OrganizationCoverage,
}
/// A repository and its pinned default-branch revision.
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
pub struct OrganizationRepository {
/// GitHub owner and repository name.
pub name: String,
/// Full commit identifier, absent for an empty or unresolved repository.
pub commit: Option<String>,
}
/// A Cargo package in an organization snapshot.
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
pub struct OrganizationPackage {
/// Index into the organization's repository records.
pub repository: usize,
/// Cargo package name.
pub name: String,
/// Repository-relative manifest path.
pub manifest: String,
}
/// Completeness of the accessible organization corpus.
#[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize)]
pub struct OrganizationCoverage {
/// Every enumerated source was analyzed successfully.
pub complete: bool,
/// Failures preventing complete coverage.
pub failures: Vec<String>,
}
#[cfg(feature = "std")]
pub(crate) fn path_label(path: &std::path::Path) -> String {
#[cfg(windows)]
{
path.to_string_lossy().replace('\\', "/")
}
#[cfg(not(windows))]
{
path.to_string_lossy().into_owned()
}
}