clean up
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user