@@ -103,32 +103,36 @@ def print_culprits(matches, args):
103103 if args .summarize :
104104 match_groups [test ].append (f"{ filename } :{ start_line_no } " )
105105 else :
106- hint = Panel (
107- Markdown (test .hint , justify = "left" ),
108- title = "Hint:" ,
109- title_align = "left" ,
110- padding = (0 , 2 ),
111- )
106+ message_bits = []
112107
113- if args .code_padding == - 1 :
114- message = hint
115- else :
108+ if args .code_padding != - 1 :
116109 lexer = Syntax .guess_lexer (filename )
117- syntax = Syntax (
118- match .string ,
119- lexer = lexer ,
120- line_numbers = True ,
121- line_range = (
122- start_line_no - args .code_padding ,
123- end_line_no + args .code_padding ,
124- ),
125- highlight_lines = range (start_line_no , end_line_no + 1 ),
110+ message_bits .append (
111+ Syntax (
112+ match .string ,
113+ lexer = lexer ,
114+ line_numbers = True ,
115+ line_range = (
116+ start_line_no - args .code_padding ,
117+ end_line_no + args .code_padding ,
118+ ),
119+ highlight_lines = range (start_line_no , end_line_no + 1 ),
120+ )
121+ )
122+
123+ if test .hint :
124+ message_bits .append (
125+ Panel (
126+ Markdown (test .hint , justify = "left" ),
127+ title = "Hint:" ,
128+ title_align = "left" ,
129+ padding = (0 , 2 ),
130+ )
126131 )
127- message = Group (syntax , hint )
128132
129133 messages .append (
130134 Panel (
131- message ,
135+ Group ( * message_bits ) ,
132136 title = f"{ 'Error' if test .error else 'Warning' } : { test .name } " ,
133137 title_align = "left" ,
134138 subtitle = f"{ filename } :{ start_line_no } " ,
@@ -140,13 +144,18 @@ def print_culprits(matches, args):
140144
141145 if args .summarize :
142146 for test , filenames in match_groups .items ():
143- hint = Panel (
144- Markdown (test .hint , justify = "left" ),
145- title = "Hint:" ,
146- title_align = "left" ,
147- padding = (0 , 2 ),
148- )
149- group = Group (Group (* filenames ), hint )
147+ group = Group (* filenames )
148+ if test .hint :
149+ group = Group (
150+ group ,
151+ Panel (
152+ Markdown (test .hint , justify = "left" ),
153+ title = "Hint:" ,
154+ title_align = "left" ,
155+ padding = (0 , 2 ),
156+ ),
157+ )
158+
150159 messages .append (
151160 Panel (
152161 group ,
0 commit comments