Skip to main content

rta_core/
lib.rs

1pub mod analyzers;
2pub mod collector;
3pub mod json;
4pub mod model;
5pub mod pack;
6pub mod report;
7pub mod scoring;
8
9use std::path::Path;
10
11use analyzers::{
12    architecture::ArchitectureAnalyzer, code_quality::CodeQualityAnalyzer,
13    dependencies::DependencyAnalyzer, overview::OverviewAnalyzer, risks::RiskAnalyzer,
14    testing::TestingAnalyzer, Analyzer,
15};
16use collector::RepositorySnapshot;
17use model::AuditReport;
18
19pub fn audit_repository(path: &Path) -> Result<AuditReport, String> {
20    let snapshot = RepositorySnapshot::collect(path)?;
21    let overview = OverviewAnalyzer.analyze(&snapshot);
22    let dependencies = DependencyAnalyzer.analyze(&snapshot);
23    let code_quality = CodeQualityAnalyzer.analyze(&snapshot);
24    let architecture = ArchitectureAnalyzer.analyze(&snapshot);
25    let testing = TestingAnalyzer.analyze(&snapshot);
26    let risks = RiskAnalyzer::new(
27        &overview,
28        &dependencies,
29        &code_quality,
30        &architecture,
31        &testing,
32    )
33    .analyze(&snapshot);
34    let overall_score = scoring::overall_score(
35        &dependencies,
36        &code_quality,
37        &architecture,
38        &testing,
39        &risks,
40    );
41
42    Ok(AuditReport {
43        repository_path: snapshot.root.display().to_string(),
44        overview,
45        dependencies,
46        code_quality,
47        architecture,
48        testing,
49        risks,
50        overall_score,
51    })
52}