clean up
Some checks failed
CI / Check / Test (push) Successful in 3m6s
Architecture Docs / Generate diagrams (push) Has been cancelled

This commit is contained in:
2026-06-17 11:28:54 +02:00
parent 0e77ee623a
commit a7e466011b
35 changed files with 174 additions and 2131 deletions

View File

@@ -298,8 +298,11 @@ impl CodeGraph {
crate_to_module.insert(element.name().to_string(), module);
}
let graph_modules: HashSet<String> =
self.modules().iter().map(|m| m.as_str().to_string()).collect();
let graph_modules: HashSet<String> = self
.modules()
.iter()
.map(|m| m.as_str().to_string())
.collect();
for rel in project_graph.relationships() {
let src_module = crate_to_module.get(rel.source());
@@ -308,8 +311,7 @@ impl CodeGraph {
&& src != tgt
&& graph_modules.contains(src)
&& graph_modules.contains(tgt)
&& let Ok(edge) =
Relationship::new(src, tgt, RelationshipKind::Composition)
&& let Ok(edge) = Relationship::new(src, tgt, RelationshipKind::Composition)
{
self.add_relationship(edge);
}

View File

@@ -44,9 +44,7 @@ impl NormalizedGraph {
self.0.modules()
}
pub fn elements_by_module(
&self,
) -> (HashMap<String, Vec<&CodeElement>>, Vec<&CodeElement>) {
pub fn elements_by_module(&self) -> (HashMap<String, Vec<&CodeElement>>, Vec<&CodeElement>) {
self.0.elements_by_module()
}

View File

@@ -13,6 +13,6 @@ pub use value_objects::graph::{CodeElementKind, RelationshipKind, Visibility};
pub use value_objects::output::{DiagramLevel, OutputConfig, RenderOutput, RenderedFile};
pub use value_objects::rules::{BoundaryRule, RuleKind, RuleViolation, check_boundary_rules};
pub use value_objects::source::{
FilePath, Language, ModuleAssignment, ModuleName, SourceFile,
normalize_cargo_package, normalize_python_package,
FilePath, Language, ModuleAssignment, ModuleName, SourceFile, normalize_cargo_package,
normalize_python_package,
};

View File

@@ -353,5 +353,8 @@ fn module_edges_excludes_intra_module_relationships() {
let graph = graph.qualify();
let edges = graph.module_edges();
assert!(edges.is_empty(), "intra-module relationships should not produce edges");
assert!(
edges.is_empty(),
"intra-module relationships should not produce edges"
);
}

View File

@@ -89,7 +89,12 @@ fn merge_project_edges_ignores_crates_with_no_matching_module() {
.unwrap(),
);
project_graph.add_relationship(
Relationship::new("external-lib", "myapp-domain", RelationshipKind::Composition).unwrap(),
Relationship::new(
"external-lib",
"myapp-domain",
RelationshipKind::Composition,
)
.unwrap(),
);
graph.merge_project_edges(&project_graph);