Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
717 changes: 370 additions & 347 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion benches/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.0.0"
authors = ["Matthias Endler <matthias@endler.dev>"]
license = "Apache-2.0/MIT"
description = "Criterion benchmarks of the lychee crates"
edition = "2021"
edition = "2024"
publish = false

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions benches/src/extract.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use lychee_lib::extract::Extractor;
use criterion::{Criterion, black_box, criterion_group, criterion_main};
use lychee_lib::InputContent;
use lychee_lib::extract::Extractor;
use std::path::PathBuf;

fn extract(paths: &[PathBuf]) {
Expand Down
2 changes: 1 addition & 1 deletion examples/builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "builder"
version = "0.1.0"
edition = "2021"
edition = "2024"

[[example]]
name = "builder"
Expand Down
2 changes: 1 addition & 1 deletion examples/builder/builder.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use http::header::{self, HeaderMap};
use http::StatusCode;
use http::header::{self, HeaderMap};
use lychee_lib::{ClientBuilder, Result};
use regex::RegexSet;
use reqwest::Method;
Expand Down
2 changes: 1 addition & 1 deletion examples/chain/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "chain"
version = "0.1.0"
edition = "2021"
edition = "2024"

[[example]]
name = "chain"
Expand Down
2 changes: 1 addition & 1 deletion examples/chain/chain.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_trait::async_trait;
use lychee_lib::{chain::RequestChain, ChainResult, ClientBuilder, Handler, Result, Status};
use lychee_lib::{ChainResult, ClientBuilder, Handler, Result, Status, chain::RequestChain};
use reqwest::{Method, Request};

#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion examples/client_pool/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "client_pool"
version = "0.1.0"
edition = "2021"
edition = "2024"

[[example]]
name = "client_pool"
Expand Down
2 changes: 1 addition & 1 deletion examples/collect_links/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "collect_links"
version = "0.1.0"
edition = "2021"
edition = "2024"

[[example]]
name = "collect_links"
Expand Down
2 changes: 1 addition & 1 deletion examples/extract/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "extract"
version = "0.1.0"
edition = "2021"
edition = "2024"

[[example]]
name = "extract"
Expand Down
2 changes: 1 addition & 1 deletion examples/extract/extract.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use lychee_lib::extract::Extractor;
use lychee_lib::Result;
use lychee_lib::extract::Extractor;
use lychee_lib::{FileType, InputContent};
use std::fs;

Expand Down
2 changes: 1 addition & 1 deletion examples/simple/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "simple"
version = "0.1.0"
edition = "2021"
edition = "2024"

[[example]]
name = "simple"
Expand Down
4 changes: 2 additions & 2 deletions lychee-bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ authors = ["Matthias Endler <matthias@endler.dev>"]
description = "A fast, async link checker"
documentation = "https://docs.rs/lychee"
homepage = "https://github.com/lycheeverse/lychee"
edition = "2021"
edition = "2024"
keywords = ["link", "checker", "cli", "link-checker", "validator"]
license = "Apache-2.0 OR MIT"
repository = "https://github.com/lycheeverse/lychee"
readme = "../README.md"
version.workspace = true
rust-version = "1.83.0"
rust-version = "1.85.0"

[dependencies]
# NOTE: We need to specify the version of lychee-lib here because crates.io
Expand Down
2 changes: 1 addition & 1 deletion lychee-bin/src/archive/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use std::{fmt::Display, time::Duration};
use strum::{Display, EnumIter, EnumString, VariantNames};

use crate::color::{color, GREEN, PINK};
use crate::color::{GREEN, PINK, color};

mod wayback;

Expand Down
2 changes: 1 addition & 1 deletion lychee-bin/src/cache.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::time::{self, timestamp, Timestamp};
use crate::time::{self, Timestamp, timestamp};
use anyhow::Result;
use dashmap::DashMap;
use lychee_lib::{CacheStatus, Status, Uri};
Expand Down
2 changes: 1 addition & 1 deletion lychee-bin/src/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::formatters::response::ResponseFormatter;
use crate::options::OutputMode;
use crate::parse::parse_duration_secs;
use crate::verbosity::Verbosity;
use crate::{cache::Cache, stats::ResponseStats, ExitCode};
use crate::{ExitCode, cache::Cache, stats::ResponseStats};

use super::CommandParams;

Expand Down
2 changes: 1 addition & 1 deletion lychee-bin/src/commands/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use std::io::{self, Write};
use std::path::PathBuf;
use tokio_stream::StreamExt;

use crate::verbosity::Verbosity;
use crate::ExitCode;
use crate::verbosity::Verbosity;

use super::CommandParams;

Expand Down
2 changes: 1 addition & 1 deletion lychee-bin/src/formatters/response/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use lychee_lib::{CacheStatus, ResponseBody, Status};

use crate::formatters::color::{DIM, GREEN, NORMAL, PINK, YELLOW};

use super::{ResponseFormatter, MAX_RESPONSE_OUTPUT_WIDTH};
use super::{MAX_RESPONSE_OUTPUT_WIDTH, ResponseFormatter};

/// A colorized formatter for the response body
///
Expand Down
8 changes: 5 additions & 3 deletions lychee-bin/src/formatters/response/emoji.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ mod emoji_tests {
);

// Just assert the output contains the string
assert!(formatter
.format_detailed_response(&body)
.ends_with("| URL is missing a host"));
assert!(
formatter
.format_detailed_response(&body)
.ends_with("| URL is missing a host")
);
}
}
8 changes: 5 additions & 3 deletions lychee-bin/src/formatters/stats/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{
time::Duration,
};

use crate::formatters::color::{color, BOLD_GREEN, BOLD_PINK, BOLD_YELLOW, DIM, NORMAL};
use crate::formatters::color::{BOLD_GREEN, BOLD_PINK, BOLD_YELLOW, DIM, NORMAL, color};
use crate::{formatters::get_response_formatter, options, stats::ResponseStats};

use super::StatsFormatter;
Expand Down Expand Up @@ -185,8 +185,10 @@ mod tests {
assert!(result.contains("🚫 2 Errors"));

assert!(result.contains("[https://example.com/]:"));
assert!(result
.contains("https://github.com/mre/idiomatic-rust-doesnt-exist-man | 404 Not Found"));
assert!(
result
.contains("https://github.com/mre/idiomatic-rust-doesnt-exist-man | 404 Not Found")
);
assert!(result.contains("https://github.com/mre/boom | 500 Internal Server Error"));
}
}
6 changes: 4 additions & 2 deletions lychee-bin/src/formatters/stats/detailed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ mod tests {
assert!(result.contains("❓ Unknown..........0"));
assert!(result.contains("🚫 Errors...........2"));
assert!(result.contains("Errors in https://example.com/"));
assert!(result
.contains("https://github.com/mre/idiomatic-rust-doesnt-exist-man | 404 Not Found"));
assert!(
result
.contains("https://github.com/mre/idiomatic-rust-doesnt-exist-man | 404 Not Found")
);
assert!(result.contains("https://github.com/mre/boom | 500 Internal Server Error"));
}
}
2 changes: 1 addition & 1 deletion lychee-bin/src/formatters/stats/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use http::StatusCode;
use lychee_lib::{InputSource, ResponseBody, Status};
use std::fmt::Write;
use tabled::{
settings::{object::Segment, Alignment, Modify, Style},
Table, Tabled,
settings::{Alignment, Modify, Style, object::Segment},
};

use crate::stats::ResponseStats;
Expand Down
16 changes: 11 additions & 5 deletions lychee-bin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ use std::io::{self, BufRead, BufReader, ErrorKind, Write};
use std::path::PathBuf;
use std::sync::Arc;

use anyhow::{bail, Context, Error, Result};
use anyhow::{Context, Error, Result, bail};
use clap::Parser;
use commands::CommandParams;
use formatters::{get_stats_formatter, log::init_logging};
Expand Down Expand Up @@ -95,7 +95,7 @@ use crate::formatters::duration::Duration;
use crate::{
cache::{Cache, StoreExt},
formatters::stats::StatsFormatter,
options::{Config, LycheeOptions, LYCHEE_CACHE_FILE, LYCHEE_IGNORE_FILE},
options::{Config, LYCHEE_CACHE_FILE, LYCHEE_IGNORE_FILE, LycheeOptions},
};

/// A C-like enum that can be cast to `i32` and used as process exit code.
Expand Down Expand Up @@ -169,7 +169,9 @@ fn load_config() -> Result<LycheeOptions> {

// TODO: Remove this warning and the parameter with 1.0
if !&opts.config.exclude_file.is_empty() {
warn!("WARNING: `--exclude-file` is deprecated and will soon be removed; use the `{LYCHEE_IGNORE_FILE}` file to ignore URL patterns instead. To exclude paths of files and directories, use `--exclude-path`.");
warn!(
"WARNING: `--exclude-file` is deprecated and will soon be removed; use the `{LYCHEE_IGNORE_FILE}` file to ignore URL patterns instead. To exclude paths of files and directories, use `--exclude-path`."
);
}

// TODO: Remove this warning and the parameter with 1.0
Expand Down Expand Up @@ -296,7 +298,9 @@ async fn run(opts: &LycheeOptions) -> Result<i32> {
(Some(base), None) => Some(base),
(None, Some(base_url)) => Some(base_url),
(Some(_base), Some(base_url)) => {
warn!("WARNING: Both, `--base` and `--base-url` are set. Using `base-url` and ignoring `--base` (as it's deprecated).");
warn!(
"WARNING: Both, `--base` and `--base-url` are set. Using `base-url` and ignoring `--base` (as it's deprecated)."
);
Some(base_url)
}
};
Expand Down Expand Up @@ -383,7 +387,9 @@ async fn run(opts: &LycheeOptions) -> Result<i32> {
}

if github_issues && opts.config.github_token.is_none() {
warn!("There were issues with GitHub URLs. You could try setting a GitHub token and running lychee again.",);
warn!(
"There were issues with GitHub URLs. You could try setting a GitHub token and running lychee again.",
);
}

if opts.config.cache {
Expand Down
12 changes: 6 additions & 6 deletions lychee-bin/src/options.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
use crate::archive::Archive;
use crate::parse::parse_base;
use crate::verbosity::Verbosity;
use anyhow::{anyhow, Context, Error, Result};
use anyhow::{Context, Error, Result, anyhow};
use clap::builder::PossibleValuesParser;
use clap::{arg, builder::TypedValueParser, Parser};
use clap::{Parser, arg, builder::TypedValueParser};
use const_format::{concatcp, formatcp};
use http::{
header::{HeaderName, HeaderValue},
HeaderMap,
header::{HeaderName, HeaderValue},
};
use lychee_lib::{
Base, BasicAuthSelector, FileExtensions, FileType, Input, StatusCodeExcluder,
StatusCodeSelector, DEFAULT_MAX_REDIRECTS, DEFAULT_MAX_RETRIES, DEFAULT_RETRY_WAIT_TIME_SECS,
DEFAULT_TIMEOUT_SECS, DEFAULT_USER_AGENT,
Base, BasicAuthSelector, DEFAULT_MAX_REDIRECTS, DEFAULT_MAX_RETRIES,
DEFAULT_RETRY_WAIT_TIME_SECS, DEFAULT_TIMEOUT_SECS, DEFAULT_USER_AGENT, FileExtensions,
FileType, Input, StatusCodeExcluder, StatusCodeSelector,
};
use reqwest::tls;
use secrecy::{ExposeSecret, SecretString};
Expand Down
2 changes: 1 addition & 1 deletion lychee-bin/src/parse.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::{Context, Result};
use lychee_lib::{remap::Remaps, Base};
use lychee_lib::{Base, remap::Remaps};
use std::time::Duration;

/// Parse seconds into a `Duration`
Expand Down
2 changes: 1 addition & 1 deletion lychee-bin/src/verbosity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl<'de> Deserialize<'de> for Verbosity {
level => {
return Err(serde::de::Error::custom(format!(
"invalid log level `{level}`"
)))
)));
}
};
Ok(Verbosity {
Expand Down
4 changes: 2 additions & 2 deletions lychee-bin/tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mod cli {
use http::{Method, StatusCode};
use lychee_lib::{InputSource, ResponseBody};
use predicates::{
prelude::{predicate, PredicateBooleanExt},
prelude::{PredicateBooleanExt, predicate},
str::{contains, is_empty},
};
use pretty_assertions::assert_eq;
Expand All @@ -24,7 +24,7 @@ mod cli {
use serde_json::Value;
use tempfile::NamedTempFile;
use uuid::Uuid;
use wiremock::{matchers::basic_auth, Mock, ResponseTemplate};
use wiremock::{Mock, ResponseTemplate, matchers::basic_auth};

type Result<T> = std::result::Result<T, Box<dyn Error>>;

Expand Down
4 changes: 2 additions & 2 deletions lychee-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name = "lychee-lib"
authors = ["Matthias Endler <matthias@endler.dev>"]
description = "A fast, async link checker"
documentation = "https://docs.rs/lychee_lib"
edition = "2021"
edition = "2024"
homepage = "https://github.com/lycheeverse/lychee"
keywords = ["link", "checker", "cli", "link-checker", "validator"]
license = "Apache-2.0 OR MIT"
repository = "https://github.com/lycheeverse/lychee"
readme = "../README.md"
version.workspace = true
rust-version = "1.83.0"
rust-version = "1.85.0"

[dependencies]
async-stream = "0.3.6"
Expand Down
2 changes: 1 addition & 1 deletion lychee-lib/src/checker/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use log::warn;
use std::path::{Path, PathBuf};

use crate::{
utils::fragment_checker::{FragmentChecker, FragmentInput},
Base, ErrorKind, Status, Uri,
utils::fragment_checker::{FragmentChecker, FragmentInput},
};

/// A utility for checking the existence and validity of file-based URIs.
Expand Down
2 changes: 1 addition & 1 deletion lychee-lib/src/checker/mail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::ErrorKind;
use crate::{Status, Uri};

#[cfg(all(feature = "email-check", feature = "native-tls"))]
use check_if_email_exists::{check_email, CheckEmailInput, Reachable};
use check_if_email_exists::{CheckEmailInput, Reachable, check_email};

#[cfg(all(feature = "email-check", feature = "native-tls"))]
use crate::types::mail;
Expand Down
2 changes: 1 addition & 1 deletion lychee-lib/src/checker/website.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::{
BasicAuthCredentials, ErrorKind, Status, Uri,
chain::{Chain, ChainResult, ClientRequestChains, Handler, RequestChain},
quirks::Quirks,
retry::RetryExt,
types::uri::github::GithubUri,
utils::fragment_checker::{FragmentChecker, FragmentInput},
BasicAuthCredentials, ErrorKind, Status, Uri,
};
use async_trait::async_trait;
use http::{Method, StatusCode};
Expand Down
Loading