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
#![cfg_attr(coverage_nightly, coverage(off))]
//! Toyota Way: TDG (Technical Debt Gradient) Formatting Handler
//! Complexity: Reduced from 16 to individual functions <=8
//! Purpose: TDG report formatting with clean separation of concerns
/// Toyota Way: Single Responsibility - Format TDG summary as markdown
/// Extracted from stubs.rs to reduce complexity and improve maintainability
///
/// # Parameters
///
/// * `summary` - TDG analysis summary
/// * `include_components` - Whether to include component details
///
/// # Returns
///
/// Formatted markdown string
#[must_use]
#[provable_contracts_macros::contract("pmat-core.yaml", equation = "check_compliance")]
pub fn format_markdown_output(
summary: &crate::models::tdg::TDGSummary,
include_components: bool,
) -> String {
let mut md = String::new();
// Header and summary
add_header_and_summary(&mut md, summary);
// Hotspots section
if !summary.hotspots.is_empty() {
add_hotspots_section(&mut md, &summary.hotspots);
}
// Components section if requested
if include_components {
add_components_section(&mut md);
}
md
}
// Helper functions for markdown section generation (header, summary, hotspots, components)
include!("tdg_formatter_helpers.rs");
// Unit tests for TDG formatter markdown output
include!("tdg_formatter_tests.rs");
// Property-based tests using proptest for TDG formatter invariants
include!("tdg_formatter_proptests.rs");