-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmod.rs
More file actions
62 lines (55 loc) · 1.67 KB
/
Copy pathmod.rs
File metadata and controls
62 lines (55 loc) · 1.67 KB
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
59
60
61
62
// SPDX-License-Identifier: MPL-2.0
// SPDX-FileCopyrightText: 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
//! Report generation module
pub mod diff;
pub mod formatter;
pub mod generator;
#[cfg(feature = "gui")]
pub mod gui;
pub mod gui_text;
pub mod migration;
pub mod output;
pub mod sarif;
pub mod tui;
use crate::types::*;
use anyhow::Result;
use std::fs;
use std::path::Path;
pub use diff::{format_diff, load_report};
pub use formatter::{ReportFormatter, ReportView};
pub use generator::ReportGenerator;
#[cfg(feature = "gui")]
pub use gui::ReportGui;
pub use output::ReportOutputFormat;
pub use tui::ReportTui;
/// Generate a comprehensive assault report
pub fn generate_assault_report(
assail_report: AssailReport,
attack_results: Vec<AttackResult>,
) -> Result<AssaultReport> {
// Centralize report construction so scoring logic stays in one module.
let generator = ReportGenerator::new();
generator.generate(assail_report, attack_results)
}
/// Save report to file with the requested format
pub fn save_report<P: AsRef<Path>>(
report: &AssaultReport,
path: P,
format: ReportOutputFormat,
) -> Result<()> {
// Output format selection is delegated to the formatter enum for consistency.
let serialized = format.serialize(report)?;
fs::write(path, serialized)?;
Ok(())
}
/// Print report to console with view/depth controls
pub fn print_report(
report: &AssaultReport,
view: ReportView,
expand_details: bool,
show_matrix: bool,
) {
// Console rendering always flows through ReportFormatter view contracts.
let formatter = ReportFormatter::new();
formatter.print_with_view(report, view, expand_details, show_matrix);
}