diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..e9967dc --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,8 @@ +# On Windows MSVC, statically link the C runtime so that the resulting EXE does +# not depend on the vcruntime DLL. +[target.x86_64-pc-windows-msvc] +rustflags = ["-C", "target-feature=+crt-static"] +[target.i686-pc-windows-msvc] +rustflags = ["-C", "target-feature=+crt-static"] +[target.aarch64-pc-windows-msvc] +rustflags = ["-C", "target-feature=+crt-static"] diff --git a/.husky/commit-msg b/.husky/commit-msg deleted file mode 100644 index bdfc2a0..0000000 --- a/.husky/commit-msg +++ /dev/null @@ -1 +0,0 @@ -pnpm exec commit $1 diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100644 index 8ba25f3..0000000 --- a/.husky/pre-commit +++ /dev/null @@ -1 +0,0 @@ -pnpm exec lint-staged --concurrent false diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 009aa06..0000000 --- a/.npmrc +++ /dev/null @@ -1,2 +0,0 @@ -shamefully-hoist=true -auto-install-peers=true diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 8372aa1..0000000 --- a/.prettierignore +++ /dev/null @@ -1,2 +0,0 @@ -CHANGELOG.md -config.json diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index b2095be..0000000 --- a/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "semi": false, - "singleQuote": true -} diff --git a/src/main.rs b/src/main.rs index eeac073..a282b8d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,10 @@ mod config; mod i18n; mod utils; -use std::{collections::HashMap, path::PathBuf}; +use std::{ + collections::{HashMap, HashSet}, + path::PathBuf, +}; use config::{init_config, print_config}; use i18n::t; @@ -26,6 +29,9 @@ fn run(root_path: PathBuf) -> Result<(), Box> { let mut result: HashMap>> = HashMap::new(); + // Deduplicate logs by repoName and typeName + let mut dedup_map: HashMap>> = HashMap::new(); + for repo_dir in &config.repos { // Get repo name let repo_name = @@ -60,12 +66,23 @@ fn run(root_path: PathBuf) -> Result<(), Box> { for log in filtered_logs { let log_info = format_log(&log); let type_name = log_info.type_name.clone(); - result + + // get HashSet of type_name in repo_name, if not exist, create a new one + let type_set = dedup_map .entry(repo_name.clone()) .or_default() - .entry(type_name) - .or_default() - .push(log_info); + .entry(type_name.clone()) + .or_default(); + + // if message not in type_set, push to result + if type_set.insert(log_info.message.clone()) { + result + .entry(repo_name.clone()) + .or_default() + .entry(type_name) + .or_default() + .push(log_info); + } } save_report_markdown(&result, &root_path)?;