Skip to content

Commit

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

* Fix formatting issue

---------

Co-authored-by: Tanishq <[email protected]>
  • Loading branch information
amtanq and Tanishq authored Apr 5, 2024
1 parent 866eb0c commit 7bf429b
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 7bf429b

Please sign in to comment.