@@ -93,10 +93,11 @@ def _format_terminal(results: list[dict[str, object]]) -> str:
9393 from rich .markup import escape
9494 from rich .panel import Panel
9595 from rich .table import Table
96+ from rich .text import Text
9697 except ImportError :
9798 return _format_terminal_plain (results )
9899
99- capture = Console (record = True , force_terminal = True , width = 80 , file = StringIO ())
100+ capture = Console (record = True , force_terminal = True , width = 80 , file = StringIO (), emoji = False )
100101 total = len (results )
101102
102103 critical = _count_sev (results , "CRITICAL" )
@@ -182,15 +183,15 @@ def _format_terminal(results: list[dict[str, object]]) -> str:
182183 lr = _lr_icon (sev , lang )
183184
184185 if r .get ("error" ):
185- table .add_row (escape (_terminal_text (name )), "-" , "ERR" , "[red]ERROR[/red]" , "—" , escape (_terminal_text (lang )))
186+ table .add_row (Text (_terminal_text (name )), "-" , "ERR" , "[red]ERROR[/red]" , "—" , Text (_terminal_text (lang )))
186187 else :
187188 table .add_row (
188- escape (_terminal_text (name )),
189+ Text (_terminal_text (name )),
189190 lr ,
190191 f"[{ color } ]{ score } /100[/{ color } ]" ,
191192 f"[{ color } ]{ escape (_terminal_text (sev ))} [/{ color } ]" ,
192193 str (issues ),
193- escape (_terminal_text (lang )),
194+ Text (_terminal_text (lang )),
194195 )
195196 capture .print (table )
196197 capture .print ()
@@ -239,7 +240,7 @@ def _lr_icon(severity: str, language: str) -> str:
239240
240241
241242def _print_source_breakdown (c , results : list [dict [str , object ]]) -> None :
242- from rich .markup import escape
243+ from rich .text import Text
243244
244245 group_stats : dict [str , dict [str , int ]] = defaultdict (
245246 lambda : {"total" : 0 , "CRITICAL" : 0 , "HIGH" : 0 , "MEDIUM" : 0 , "LOW" : 0 }
@@ -255,19 +256,20 @@ def _print_source_breakdown(c, results: list[dict[str, object]]) -> None:
255256 c .print ("[bold]Source Breakdown:[/bold]" )
256257 for group in sorted (group_stats ):
257258 st = group_stats [group ]
258- parts = [f" { escape (_terminal_text (group )):<30s} { st ['total' ]:>4d} skills" ]
259+ prefix = Text (f" { _terminal_text (group ):<30s} { st ['total' ]:>4d} skills" )
260+ parts = []
259261 if st ["CRITICAL" ]:
260262 parts .append (f"[bold red]{ st ['CRITICAL' ]} CRITICAL[/bold red]" )
261263 if st ["HIGH" ]:
262264 parts .append (f"[red]{ st ['HIGH' ]} HIGH[/red]" )
263265 if st ["MEDIUM" ]:
264266 parts .append (f"[yellow]{ st ['MEDIUM' ]} MEDIUM[/yellow]" )
265- c .print (", " .join (parts ))
267+ c .print (prefix + Text . from_markup (( ", " + ", " .join (parts )) if parts else "" ))
266268 c .print ()
267269
268270
269271def _print_language_breakdown (c , results : list [dict [str , object ]]) -> None :
270- from rich .markup import escape
272+ from rich .text import Text
271273
272274 lang_stats : dict [str , int ] = defaultdict (int )
273275 lang_non_en : set [str ] = set ()
@@ -285,15 +287,15 @@ def _print_language_breakdown(c, results: list[dict[str, object]]) -> None:
285287 c .print (f" { lang :<6s} { count :>4d} skills (static + LLM coverage: full)" )
286288 else :
287289 c .print (
288- f" { escape ( _terminal_text (lang )) :<6s} { count :>4d} skills "
289- f"[yellow] (static: partial, LLM: full)[/ yellow]"
290+ Text ( f" { _terminal_text (lang ):<6s} { count :>4d} skills " )
291+ + Text ( " (static: partial, LLM: full)" , style = " yellow" )
290292 )
291293 c .print ()
292294
293295
294296def _terminal_text (value : object ) -> str :
295297 """Keep an untrusted console field on one line without terminal controls."""
296- return " " .join ("" .join (c for c in str (value ) if c .isprintable () or c in " \r \n \t " ).split ())
298+ return " " .join ("" .join (c for c in str (value ) if c .isprintable () or c . isspace () ).split ())
297299
298300
299301def _format_terminal_plain (results : list [dict [str , object ]]) -> str :
0 commit comments