Avoid excessive amount of data in large repos

This commit is contained in:
Joscha 2023-08-17 19:18:25 +02:00
parent 67205ab7cf
commit fa9cf9d1c5

View file

@ -96,6 +96,17 @@ fn count(path: &Path) -> somehow::Result<Counts> {
} }
} }
// Avoid excessive amounts of data in very large repos
if counts.files_by_dir.len() > 1000 {
counts.files_by_dir.retain(|name, _| !name.contains('/'));
}
if counts.lines_by_dir.len() > 1000 {
counts.lines_by_dir.retain(|name, _| !name.contains('/'));
}
if counts.todos_by_dir.len() > 1000 {
counts.todos_by_dir.retain(|name, _| !name.contains('/'));
}
Ok(counts) Ok(counts)
} }