Skip to content

Commit

Permalink
feat: Output add release_count
Browse files Browse the repository at this point in the history
  • Loading branch information
zjp-CN committed Nov 19, 2024
1 parent 3c248ce commit ec4a065
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/repo/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{database::diag_total_count, prelude::*};
use crate::{crates_io::get_release_count, database::diag_total_count, prelude::*};
use cargo_metadata::Package;
use eyre::ContextCompat;
use output::Output;
Expand Down Expand Up @@ -83,6 +83,7 @@ impl Repo {
let pkg_name = pkg.name.as_str();
let mut output = Output::new(pkg, test_cases.swap_remove(pkg_name));
output.diag_total_count = diag_total_count([&self.user, &self.repo, pkg_name]);
output.release_count = get_release_count(pkg_name);
assert!(
outputs.insert(pkg_name, output).is_none(),
"os-checker can't handle duplicated package names in a repo"
Expand Down
3 changes: 3 additions & 0 deletions src/repo/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ pub struct Output {
pub categories: Vec<String>,
pub os_categories: Vec<String>,
pub diag_total_count: Option<usize>,
/// crates.io 发版次数
pub release_count: Option<usize>,
}

impl Output {
Expand Down Expand Up @@ -55,6 +57,7 @@ impl Output {
})
.unwrap_or_default(),
diag_total_count: None,
release_count: None,
}
}
}

0 comments on commit ec4a065

Please sign in to comment.