From 48c54ba51ed0a328c56c46b7ee46a22f5507c545 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 1 Jul 2025 10:11:41 +0000 Subject: [PATCH 1/3] chore: bump clap from 4.5.39 to 4.5.40 in the dependencies group Bumps the dependencies group with 1 update: [clap](https://github.com/clap-rs/clap). Updates `clap` from 4.5.39 to 4.5.40 - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.39...clap_complete-v4.5.40) --- updated-dependencies: - dependency-name: clap dependency-version: 4.5.40 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: dependencies ... Signed-off-by: dependabot[bot] --- Cargo.lock | 12 ++++++------ Cargo.toml | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ee95a95..460020b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.39" +version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f" +checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f" dependencies = [ "clap_builder", "clap_derive", @@ -136,9 +136,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.39" +version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51" +checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e" dependencies = [ "anstream", "anstyle", @@ -148,9 +148,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.32" +version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" +checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce" dependencies = [ "heck", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 6ec5552..3e3bab3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ categories = ["command-line-utilities"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -clap = { version = "4.5.39", features = ["derive"] } +clap = { version = "4.5.40", features = ["derive"] } git2 = { version = "0.20.2", features = [] } regex = "1.11.1" itertools = "0.14.0" From d42cc357a939004a0c93a968c01612fb6d1c6be2 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 1 Jul 2025 12:01:39 +0000 Subject: [PATCH 2/3] fix: Clippy errors --- src/analyzer.rs | 33 +++++++++++++++------------------ src/main.rs | 2 +- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/analyzer.rs b/src/analyzer.rs index b4df2e2..d51a202 100644 --- a/src/analyzer.rs +++ b/src/analyzer.rs @@ -22,13 +22,13 @@ pub(crate) fn get_commits<'repo>( if !before.is_empty() && !after.is_empty() { let before_oid = repo.revparse_single(before)?.id(); let after_oid = repo.revparse_single(after)?.id(); - revwalk.push_range(format!("{}..{}", before_oid, after_oid).as_str())?; + revwalk.push_range(format!("{before_oid}..{after_oid}").as_str())?; } else if !after.is_empty() { let after_oid = repo.revparse_single(after)?.id(); - revwalk.push_range(format!("..{}", after_oid).as_str())?; + revwalk.push_range(format!("..{after_oid}").as_str())?; } else if !before.is_empty() { let before_oid = repo.revparse_single(before)?.id(); - revwalk.push_range(format!("{}..", before_oid).as_str())?; + revwalk.push_range(format!("{before_oid}..").as_str())?; } let commits: Vec = revwalk @@ -70,8 +70,7 @@ fn get_commit_stats_for_commit<'repo>( pub(crate) fn show_commit_stats(stats: &[Result>], user_name: &String) { if stats.is_empty() { println!( - "Warning: The user \"{}\" did not contribute to this repository.", - user_name + "Warning: The user \"{user_name}\" did not contribute to this repository." ); return; } @@ -89,10 +88,10 @@ pub(crate) fn show_commit_stats(stats: &[Result>], use } }); - println!("Commit statistics for user \"{}\":", user_name); - println!("Files changed: {}", total_files_changed); - println!("Insertions: {}", total_insertions); - println!("Deletions: {}", total_deletions); + println!("Commit statistics for user \"{user_name}\":"); + println!("Files changed: {total_files_changed}"); + println!("Insertions: {total_insertions}"); + println!("Deletions: {total_deletions}"); } /// Display a message about coding habits. @@ -123,7 +122,7 @@ pub(crate) fn show_coding_habits(commits: &Vec) { println!("Commit message word occurrences:"); for (word, count) in word_counts.iter().sorted_by(|a, b| b.1.cmp(a.1)).take(10) { - println!("{}: {}", word, count); + println!("{word}: {count}"); } let commit_date_times: Vec> = commit_times @@ -143,8 +142,7 @@ pub(crate) fn show_coding_habits(commits: &Vec) { let (most_active_day, most_active_day_count) = commit_activity.iter().max_by_key(|x| x.1).unwrap(); println!( - "Most active day: {} with {} commits", - most_active_day, most_active_day_count + "Most active day: {most_active_day} with {most_active_day_count} commits" ); let mut commit_activity_hour: HashMap = HashMap::new(); @@ -158,8 +156,7 @@ pub(crate) fn show_coding_habits(commits: &Vec) { commit_activity_hour.iter().max_by_key(|x| x.1).unwrap(); println!( - "Most active hour: {} with {} commits", - most_active_hour, most_active_hour_count + "Most active hour: {most_active_hour} with {most_active_hour_count} commits" ); } @@ -176,9 +173,9 @@ pub(crate) fn show_top_committers(max: usize, commits: &Vec) { top_committers.sort_by(|a, b| b.1.cmp(a.1)); - println!("Top {} committers:", max); + println!("Top {max} committers:"); for (name, count) in top_committers.iter().take(max) { - println!("{}: {}", name, count); + println!("{name}: {count}"); } } @@ -200,11 +197,11 @@ mod tests { assert!(repo.is_empty().is_ok(), "Failed to get repository"); let commits = get_commits(&repo, "", ""); - println!("Commits: {:?}", commits); + println!("Commits: {commits:?}"); assert!(commits.is_ok(), "Failed to get commits"); let user = get_user_name(); - println!("User: {}", user); + println!("User: {user}"); assert!(!user.is_empty(), "Failed to get user name"); } } diff --git a/src/main.rs b/src/main.rs index 3b72fcc..21775e6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -101,7 +101,7 @@ fn check_directory_and_git(directory_path: &str) -> bool { } } - let git_path = format!("{}/.git", directory_path); + let git_path = format!("{directory_path}/.git"); if fs::metadata(git_path).is_err() { println!("Error: Directory is not a Git repository."); return false; From 3bd1055015734325b7691b980c35ce00a5127070 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 1 Jul 2025 12:04:47 +0000 Subject: [PATCH 3/3] fix: Formatting --- src/analyzer.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/analyzer.rs b/src/analyzer.rs index d51a202..4f2491a 100644 --- a/src/analyzer.rs +++ b/src/analyzer.rs @@ -69,9 +69,7 @@ fn get_commit_stats_for_commit<'repo>( /// Display commit statistics. pub(crate) fn show_commit_stats(stats: &[Result>], user_name: &String) { if stats.is_empty() { - println!( - "Warning: The user \"{user_name}\" did not contribute to this repository." - ); + println!("Warning: The user \"{user_name}\" did not contribute to this repository."); return; } @@ -141,9 +139,7 @@ pub(crate) fn show_coding_habits(commits: &Vec) { let (most_active_day, most_active_day_count) = commit_activity.iter().max_by_key(|x| x.1).unwrap(); - println!( - "Most active day: {most_active_day} with {most_active_day_count} commits" - ); + println!("Most active day: {most_active_day} with {most_active_day_count} commits"); let mut commit_activity_hour: HashMap = HashMap::new(); for date_time in &commit_date_times { @@ -155,9 +151,7 @@ pub(crate) fn show_coding_habits(commits: &Vec) { let (most_active_hour, most_active_hour_count) = commit_activity_hour.iter().max_by_key(|x| x.1).unwrap(); - println!( - "Most active hour: {most_active_hour} with {most_active_hour_count} commits" - ); + println!("Most active hour: {most_active_hour} with {most_active_hour_count} commits"); } pub(crate) fn show_top_committers(max: usize, commits: &Vec) {