1#[derive(Debug, Clone)]
2pub struct AuditReport {
3 pub repository_path: String,
4 pub overview: Overview,
5 pub dependencies: DependencyHealth,
6 pub code_quality: CodeQuality,
7 pub architecture: ArchitectureAssessment,
8 pub testing: TestingMaturity,
9 pub risks: RiskReport,
10 pub overall_score: u8,
11}
12
13pub trait AnalysisSection {}
14
15#[derive(Debug, Clone)]
16pub struct Overview {
17 pub crate_count: usize,
18 pub package_count: usize,
19 pub workspace_members: Vec<String>,
20 pub total_files: usize,
21 pub total_bytes: u64,
22 pub languages: Vec<LanguageStat>,
23 pub cargo_configs: Vec<String>,
24 pub summary: String,
25}
26
27impl AnalysisSection for Overview {}
28
29#[derive(Debug, Clone)]
30pub struct LanguageStat {
31 pub language: String,
32 pub files: usize,
33 pub lines: usize,
34}
35
36#[derive(Debug, Clone)]
37pub struct DependencyHealth {
38 pub total_dependencies: usize,
39 pub direct_dependencies: usize,
40 pub critical_dependencies: Vec<String>,
41 pub outdated_indicators: Vec<String>,
42 pub maintenance_risks: Vec<String>,
43 pub score: u8,
44}
45
46impl AnalysisSection for DependencyHealth {}
47
48#[derive(Debug, Clone)]
49pub struct CodeQuality {
50 pub lines_of_code: usize,
51 pub module_count: usize,
52 pub function_count: usize,
53 pub average_function_size: f32,
54 pub complexity_indicators: Vec<String>,
55 pub large_modules: Vec<String>,
56 pub god_module_candidates: Vec<String>,
57 pub score: u8,
58}
59
60impl AnalysisSection for CodeQuality {}
61
62#[derive(Debug, Clone)]
63pub struct ArchitectureAssessment {
64 pub detected_layers: Vec<String>,
65 pub domain_boundaries: Vec<String>,
66 pub module_centralization_risks: Vec<String>,
67 pub circular_dependencies: Vec<String>,
68 pub architecture_style: String,
69 pub separation_of_concerns: String,
70 pub score: u8,
71}
72
73impl AnalysisSection for ArchitectureAssessment {}
74
75#[derive(Debug, Clone)]
76pub struct TestingMaturity {
77 pub has_tests: bool,
78 pub unit_test_files: usize,
79 pub integration_test_files: usize,
80 pub test_function_count: usize,
81 pub testing_structure: String,
82 pub score: u8,
83}
84
85impl AnalysisSection for TestingMaturity {}
86
87#[derive(Debug, Clone)]
88pub struct RiskReport {
89 pub findings: Vec<RiskFinding>,
90 pub score: u8,
91}
92
93impl AnalysisSection for RiskReport {}
94
95#[derive(Debug, Clone)]
96pub struct RiskFinding {
97 pub severity: Severity,
98 pub title: String,
99 pub evidence: String,
100 pub recommendation: String,
101}
102
103#[derive(Debug, Clone, Copy)]
104pub enum Severity {
105 Low,
106 Medium,
107 High,
108}
109
110impl Severity {
111 pub fn as_str(self) -> &'static str {
112 match self {
113 Self::Low => "low",
114 Self::Medium => "medium",
115 Self::High => "high",
116 }
117 }
118}