@@ -33,22 +33,8 @@ pub fn render_complexity_report(report: &ComplexityReport, verbose: bool) -> Str
3333 ) ;
3434 if verbose {
3535 render_analyzed_files ( & mut output, report. analyzed_file_paths . as_deref ( ) ) ;
36+ render_verbose_summary ( & mut output, report) ;
3637 }
37- let _ = writeln ! (
38- output,
39- "Analyzed extensions: {}" ,
40- sorted_extensions( & report. analyzed_extensions) . join( ", " )
41- ) ;
42- let _ = writeln ! (
43- output,
44- "Max cognitive complexity: {}" ,
45- report. max_cognitive_complexity
46- ) ;
47- let _ = writeln ! (
48- output,
49- "Max cyclomatic complexity: {}" ,
50- report. max_cyclomatic_complexity
51- ) ;
5238 let _ = writeln ! (
5339 output,
5440 "Functions exceeding limits: {}" ,
@@ -82,6 +68,24 @@ pub fn render_complexity_report(report: &ComplexityReport, verbose: bool) -> Str
8268 output
8369}
8470
71+ fn render_verbose_summary ( output : & mut String , report : & ComplexityReport ) {
72+ let _ = writeln ! (
73+ output,
74+ "Analyzed extensions: {}" ,
75+ sorted_extensions( & report. analyzed_extensions) . join( ", " )
76+ ) ;
77+ let _ = writeln ! (
78+ output,
79+ "Max cognitive complexity: {}" ,
80+ report. max_cognitive_complexity
81+ ) ;
82+ let _ = writeln ! (
83+ output,
84+ "Max cyclomatic complexity: {}" ,
85+ report. max_cyclomatic_complexity
86+ ) ;
87+ }
88+
8589fn render_analyzed_files ( output : & mut String , analyzed_file_paths : Option < & [ AnalyzedFile ] > ) {
8690 if let Some ( analyzed_file_paths) = analyzed_file_paths {
8791 output. push_str ( "Files analyzed:\n " ) ;
@@ -181,9 +185,6 @@ mod tests {
181185 =================\n \
182186 \n \
183187 Number of files analyzed: 0\n \
184- Analyzed extensions: rs\n \
185- Max cognitive complexity: 15\n \
186- Max cyclomatic complexity: 10\n \
187188 Functions exceeding limits: 0\n "
188189 ) ;
189190 }
@@ -233,6 +234,9 @@ mod tests {
233234 } ;
234235 let output = render_complexity_report ( & report, true ) ;
235236 assert ! ( output. contains( "Files analyzed:\n - src/lib.rs\n " ) ) ;
237+ assert ! ( output. contains( "Analyzed extensions: rs\n " ) ) ;
238+ assert ! ( output. contains( "Max cognitive complexity: 15\n " ) ) ;
239+ assert ! ( output. contains( "Max cyclomatic complexity: 10\n " ) ) ;
236240 assert ! ( output. contains( "- Discovery: 1.234 ms\n " ) ) ;
237241 assert ! ( output. contains( "- Complexity analysis: 12.345 ms\n " ) ) ;
238242 }
0 commit comments