Skip to content

Commit

Permalink
Fix link check report inconsistency (#2472)
Browse files Browse the repository at this point in the history
* Fix link check report inconsistency

* Fix formatting issue

---------

Co-authored-by: Tanishq <tanishq@levels.fyi>
  • Loading branch information
2 people authored and Keats committed Jun 20, 2024
1 parent 6a25b62 commit 9413d94
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions components/site/src/link_checking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,15 @@ pub fn check_external_links(site: &Site) -> Vec<String> {
}
}

// Get unique links count from Vec by creating a temporary HashSet.
let unique_links_count = HashSet::<&str>::from_iter(
checked_links.iter().map(|link_def| link_def.external_link.as_str()),
)
.len();

println!(
"Checking {} external link(s). Skipping {} external link(s).{}",
// Get unique links count from Vec by creating a temporary HashSet.
HashSet::<&str>::from_iter(
checked_links.iter().map(|link_def| link_def.external_link.as_str())
)
.len(),
unique_links_count,
skipped_link_count,
if invalid_url_links == 0 {
"".to_string()
Expand Down Expand Up @@ -272,7 +274,7 @@ pub fn check_external_links(site: &Site) -> Vec<String> {

println!(
"> Checked {} external link(s): {} error(s) found.",
checked_links.len(),
unique_links_count,
errors.len()
);

Expand Down

0 comments on commit 9413d94

Please sign in to comment.