@@ -3,6 +3,7 @@ use crate::help;
3
3
use crate :: signing:: ReportSignature ;
4
4
use crate :: submission:: submit_report;
5
5
use futures:: stream:: { FuturesUnordered , StreamExt } ;
6
+ use stackmuncher_lib:: report_brief:: TechOverview ;
6
7
use stackmuncher_lib:: { code_rules:: CodeRules , config:: Config , git, report:: Report , utils:: hash_str_sha1} ;
7
8
use std:: path:: Path ;
8
9
use tracing:: { debug, info, warn} ;
@@ -171,10 +172,12 @@ pub(crate) async fn run(config: AppConfig) -> Result<(), ()> {
171
172
// save the sanitized report
172
173
combined_report. save_as_local_file ( sanitized_report_file_name, true ) ;
173
174
175
+ print_combined_stats ( & combined_report) ;
176
+
174
177
// check if the submission to the directory should go ahead
175
178
if config. dryrun {
176
179
// a dry-run was requested by the user
177
- println ! ( " Directory Profile update skipped: `--dryrun` flag. " ) ;
180
+ println ! ( " Profile update: skipped with `--dryrun` flag" ) ;
178
181
} else {
179
182
if first_run {
180
183
info ! ( "No report submission on the first run" ) ;
@@ -198,8 +201,35 @@ pub(crate) async fn run(config: AppConfig) -> Result<(), ()> {
198
201
}
199
202
200
203
// print the location of the reports
201
- println ! ( " Stack reports: {}" , report_dir. to_string_lossy( ) ) ;
204
+ println ! ( " Stack reports: {}" , report_dir. to_string_lossy( ) ) ;
202
205
info ! ( "Repo processed in {}ms" , instant. elapsed( ) . as_millis( ) ) ;
203
206
204
207
Ok ( ( ) )
205
208
}
209
+
210
+ /// Prints a one-line summary of the report for the user to get an idea and not need to look up the report file
211
+ /// E.g. `Summary (LoC/libs): Rust 12656/26, Markdown 587, PowerShell 169`
212
+ fn print_combined_stats ( report : & Report ) {
213
+ let report = report. get_overview ( ) ;
214
+
215
+ // get a summary and sort the stack by LoC
216
+ let mut tech = report. tech . iter ( ) . collect :: < Vec < & TechOverview > > ( ) ;
217
+ tech. sort_unstable_by ( |a, b| b. loc . cmp ( & a. loc ) ) ;
218
+
219
+ // prepare a single line of per-tech stats
220
+ let per_tech_stats = tech
221
+ . iter ( )
222
+ . map ( |t| {
223
+ // only include libs count if there are any
224
+ let libs = if t. libs > 0 {
225
+ [ "/" , t. libs . to_string ( ) . as_str ( ) ] . concat ( )
226
+ } else {
227
+ String :: new ( )
228
+ } ;
229
+
230
+ [ t. language . as_str ( ) , " " , t. loc . to_string ( ) . as_str ( ) , libs. as_str ( ) ] . concat ( )
231
+ } )
232
+ . collect :: < Vec < String > > ( ) ;
233
+ let per_tech_stats = per_tech_stats. as_slice ( ) . join ( ", " ) ;
234
+ println ! ( " Summary (LoC/libs): {}" , per_tech_stats) ;
235
+ }
0 commit comments