From 67b9862825faa394d0206619ea4b9e421aa2804a Mon Sep 17 00:00:00 2001 From: "Vitaly D." Date: Tue, 9 Jun 2026 04:46:03 +0300 Subject: [PATCH] refactor(repo-graph): move ignored path detection into module --- src/core/repo_graph.rs | 26 ++------------------------ src/core/repo_graph/ignored_paths.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 24 deletions(-) create mode 100644 src/core/repo_graph/ignored_paths.rs diff --git a/src/core/repo_graph.rs b/src/core/repo_graph.rs index 22c025e..38376a5 100644 --- a/src/core/repo_graph.rs +++ b/src/core/repo_graph.rs @@ -5,6 +5,7 @@ mod builder; mod generic; mod go; mod helpers; +mod ignored_paths; mod impact; mod manifest; mod node; @@ -14,6 +15,7 @@ mod types; use builder::RepoGraphBuilder; use helpers::display_path; +use ignored_paths::detect_ignored_paths; pub use impact::analyze_impact; pub use types::*; @@ -42,27 +44,3 @@ pub fn inspect_repo(repo_path: impl AsRef) -> RepoInspection { builder.finish() } - -fn detect_ignored_paths(root: &Path, builder: &mut RepoGraphBuilder) { - for (ignored_path, emit_warning) in [ - (".git", false), - ("node_modules", true), - ("target", true), - ("dist", true), - ("build", true), - (".cache", true), - (".venv", true), - ("__pycache__", true), - ("coverage", true), - ] { - if emit_warning && root.join(ignored_path).exists() { - builder.add_warning( - DetectionSeverity::Info, - DetectionCategory::IgnoredPath, - "Generated, dependency, or cache directory was ignored by RepoGraph inspection.", - Some(Path::new(ignored_path)), - None, - ); - } - } -} diff --git a/src/core/repo_graph/ignored_paths.rs b/src/core/repo_graph/ignored_paths.rs new file mode 100644 index 0000000..d43cfd3 --- /dev/null +++ b/src/core/repo_graph/ignored_paths.rs @@ -0,0 +1,28 @@ +use std::path::Path; + +use super::types::*; +use super::RepoGraphBuilder; + +pub(super) fn detect_ignored_paths(root: &Path, builder: &mut RepoGraphBuilder) { + for (ignored_path, emit_warning) in [ + (".git", false), + ("node_modules", true), + ("target", true), + ("dist", true), + ("build", true), + (".cache", true), + (".venv", true), + ("__pycache__", true), + ("coverage", true), + ] { + if emit_warning && root.join(ignored_path).exists() { + builder.add_warning( + DetectionSeverity::Info, + DetectionCategory::IgnoredPath, + "Generated, dependency, or cache directory was ignored by RepoGraph inspection.", + Some(Path::new(ignored_path)), + None, + ); + } + } +}