1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Port: a dimension analyzer produces `Finding`s for a parsed workspace.
//!
//! Each of the seven quality dimensions (IOSP, Complexity, DRY, SRP,
//! Coupling, Test Quality, Architecture) is represented in the Adapter
//! layer by a struct implementing this port. The Application layer holds
//! a `Vec<Box<dyn DimensionAnalyzer>>` and iterates over them — dimensions
//! become additive without touching use-case logic.
//!
//! Why not pass `&[SourceUnit]` directly?
//! The analyzers consume a parsed AST (`syn::File`) plus the original
//! content and path. A shared context type (`AnalysisContext`) captures
//! that triple and lets the Application layer cache parse results across
//! dimensions instead of re-parsing for each adapter.
use crateConfig;
use crateFinding;
/// A parsed source file with metadata the analyzers need.
///
/// Produced once by the Application layer after `SourceLoader` yields
/// raw `SourceUnit`s; shared by every analyzer invocation for the run.
/// The bundle passed to every analyzer for one run.
///
/// Borrowing only; the Application layer owns the backing data. Adapters
/// are free to ignore whichever field does not concern them (e.g. a
/// coupling analyzer never reads `config.complexity`).
/// Port: produce findings for one dimension over one workspace.
///
/// Implementations must be thread-safe so the Application layer can run
/// them in parallel. They must not do I/O; reading files belongs to the
/// `SourceLoader` port.