style: cargo fmt
All checks were successful
CI / Check / Test (push) Successful in 3m1s
Architecture Docs / Generate diagrams (push) Successful in 2m43s

This commit is contained in:
2026-06-17 13:44:19 +02:00
parent a24dc572bd
commit 009c821f48
14 changed files with 1834 additions and 51 deletions

View File

@@ -26,7 +26,8 @@ impl<'a> DiffDiagram<'a> {
let current = rendered.files().first().map(|f| f.content()).unwrap_or("");
let current_lines: std::collections::HashSet<&str> = current.lines().collect();
let existing_lines: std::collections::HashSet<&str> = self.existing_content.lines().collect();
let existing_lines: std::collections::HashSet<&str> =
self.existing_content.lines().collect();
let added: Vec<String> = current_lines
.difference(&existing_lines)

View File

@@ -30,7 +30,11 @@ fn project_level_returns_project_analyzer_graph() {
};
let result = use_case
.execute(Path::new("."), &AnalysisConfig::default(), DiagramLevel::Project)
.execute(
Path::new("."),
&AnalysisConfig::default(),
DiagramLevel::Project,
)
.unwrap();
assert_eq!(result.graph.elements().len(), 1);
@@ -47,7 +51,11 @@ fn project_level_without_analyzer_returns_error() {
};
let err = use_case
.execute(Path::new("."), &AnalysisConfig::default(), DiagramLevel::Project)
.execute(
Path::new("."),
&AnalysisConfig::default(),
DiagramLevel::Project,
)
.unwrap_err();
assert!(err.to_string().contains("no project analyzer"));
@@ -63,13 +71,15 @@ fn type_level_uses_source_analyzer_not_project() {
let analyzer = FakeSourceAnalyzer::new().with_result(
"src/order.rs",
AnalysisResult::new(
vec![CodeElement::new(
"Order",
CodeElementKind::Struct,
FilePath::new("src/order.rs").unwrap(),
1,
)
.unwrap()],
vec![
CodeElement::new(
"Order",
CodeElementKind::Struct,
FilePath::new("src/order.rs").unwrap(),
1,
)
.unwrap(),
],
vec![],
vec![],
),
@@ -93,7 +103,11 @@ fn type_level_uses_source_analyzer_not_project() {
};
let result = use_case
.execute(Path::new("."), &AnalysisConfig::default(), DiagramLevel::Type)
.execute(
Path::new("."),
&AnalysisConfig::default(),
DiagramLevel::Type,
)
.unwrap();
// Source element present, project element NOT merged (Type level skips merge)
@@ -110,7 +124,11 @@ fn module_level_without_project_analyzer_succeeds() {
};
let result = use_case
.execute(Path::new("."), &AnalysisConfig::default(), DiagramLevel::Module)
.execute(
Path::new("."),
&AnalysisConfig::default(),
DiagramLevel::Module,
)
.unwrap();
assert!(result.graph.elements().is_empty());
@@ -128,12 +146,14 @@ fn warnings_from_source_analysis_are_propagated() {
AnalysisResult::new(
vec![],
vec![],
vec![AnalysisWarning::new(
FilePath::new("src/broken.rs").unwrap(),
5,
"unparseable block",
)
.unwrap()],
vec![
AnalysisWarning::new(
FilePath::new("src/broken.rs").unwrap(),
5,
"unparseable block",
)
.unwrap(),
],
),
);
@@ -144,7 +164,11 @@ fn warnings_from_source_analysis_are_propagated() {
};
let result = use_case
.execute(Path::new("."), &AnalysisConfig::default(), DiagramLevel::Module)
.execute(
Path::new("."),
&AnalysisConfig::default(),
DiagramLevel::Module,
)
.unwrap();
assert_eq!(result.warnings.len(), 1);

View File

@@ -1,7 +1,7 @@
mod fakes;
use archlens_domain::{CodeGraph, NormalizedGraph, ports::DiagramRenderer};
use archlens_application::use_cases::check_freshness::CheckFreshness;
use archlens_domain::{CodeGraph, NormalizedGraph, ports::DiagramRenderer};
use fakes::FakeDiagramRenderer;
fn empty_graph() -> NormalizedGraph {

View File

@@ -1,7 +1,7 @@
mod fakes;
use archlens_domain::{CodeGraph, NormalizedGraph, ports::DiagramRenderer};
use archlens_application::use_cases::diff_diagram::DiffDiagram;
use archlens_domain::{CodeGraph, NormalizedGraph, ports::DiagramRenderer};
use fakes::FakeDiagramRenderer;
fn empty_graph() -> NormalizedGraph {

View File

@@ -12,7 +12,9 @@ impl FakeProjectAnalyzer {
}
pub fn empty() -> Self {
Self { graph: CodeGraph::new() }
Self {
graph: CodeGraph::new(),
}
}
}

View File

@@ -24,13 +24,15 @@ fn graph_with_one_module() -> NormalizedGraph {
let analyzer = FakeSourceAnalyzer::new().with_result(
"/p/src/orders/order.rs",
AnalysisResult::new(
vec![CodeElement::new(
"Order",
CodeElementKind::Struct,
FilePath::new("/p/src/orders/order.rs").unwrap(),
1,
)
.unwrap()],
vec![
CodeElement::new(
"Order",
CodeElementKind::Struct,
FilePath::new("/p/src/orders/order.rs").unwrap(),
1,
)
.unwrap(),
],
vec![],
vec![],
),
@@ -44,12 +46,22 @@ fn graph_with_one_module() -> NormalizedGraph {
fn graph_with_violation() -> NormalizedGraph {
let mut cg = CodeGraph::new();
let a = CodeElement::new("A", CodeElementKind::Struct, FilePath::new("a.rs").unwrap(), 1)
.unwrap()
.with_module(ModuleName::new("Alpha").unwrap());
let b = CodeElement::new("B", CodeElementKind::Struct, FilePath::new("b.rs").unwrap(), 1)
.unwrap()
.with_module(ModuleName::new("Beta").unwrap());
let a = CodeElement::new(
"A",
CodeElementKind::Struct,
FilePath::new("a.rs").unwrap(),
1,
)
.unwrap()
.with_module(ModuleName::new("Alpha").unwrap());
let b = CodeElement::new(
"B",
CodeElementKind::Struct,
FilePath::new("b.rs").unwrap(),
1,
)
.unwrap()
.with_module(ModuleName::new("Beta").unwrap());
cg.add_element(a);
cg.add_element(b);
cg.add_relationship(Relationship::new("A", "B", RelationshipKind::Composition).unwrap());