6363 'and must be replaced by nick_color_name'
6464 ),
6565 'modifier_irc_in' : (
66- 'modifier irc_in_xxx should be replaced by irc_in2_xxx which '
67- 'sends only valid UTF-8 data'
66+ 'modifier irc_in_{message} should be replaced by '
67+ 'irc_in2_{message} which sends only valid UTF-8 data'
6868 ),
6969 'signal_irc_out' : (
70- 'signal irc_out_xxx should be replaced by irc_out1_yyy which '
71- 'sends only valid UTF-8 data'
70+ 'signal irc_out_{message} should be replaced by '
71+ 'irc_out1_{message} which sends only valid UTF-8 data'
7272 ),
7373 'signal_irc_outtags' : (
74- 'signal irc_outtags_xxx should be replaced by irc_out1_yyy which '
75- 'sends only valid UTF-8 data'
74+ 'signal irc_outtags_{message} should be replaced by '
75+ 'irc_out1_{message} which sends only valid UTF-8 data'
7676 ),
7777 },
7878 'info' : {
@@ -149,7 +149,7 @@ def message(self, level: str, msg_name: str, line: int = 1, **kwargs):
149149 self .count [level ] += 1
150150
151151 def search_regex (self , regex : str , flags : int = 0 ,
152- max_lines : int = 1 ) -> List [Tuple [int , str ]]:
152+ max_lines : int = 1 ) -> List [Tuple [int , re . Match ]]:
153153 """
154154 Search a regular expression in each line of the script.
155155 A same line can be returned multiple times, if the string appears
@@ -163,15 +163,14 @@ def search_regex(self, regex: str, flags: int = 0,
163163 pattern = re .compile (regex , flags = flags )
164164 occur = []
165165 for match in pattern .finditer (self .script ):
166- match_str = match .group ()
167- match_lines = match_str .count ('\n ' ) + 1
166+ match_lines = match .group ().count ('\n ' ) + 1
168167 if match_lines <= max_lines :
169168 line = match .string [:match .start ()].count ('\n ' ) + 1
170- occur .append ((line , match_str ))
169+ occur .append ((line , match ))
171170 return occur
172171
173172 def search_func (self , function : str , argument : str = '' , flags : int = 0 ,
174- max_lines : int = 2 ) -> List [Tuple [int , str ]]:
173+ max_lines : int = 2 ) -> List [Tuple [int , re . Match ]]:
175174 """
176175 Search a call to a function with the given argument.
177176
@@ -247,18 +246,23 @@ def _check_deprecated_info(self):
247246
248247 def _check_modifier_irc_in (self ):
249248 """Check if modifier irc_in_xxx is used."""
250- func = self .search_func ('hook_modifier' , '["\' ]irc_in_' )
251- for line_no , _ in func :
252- self .message ('warning' , 'modifier_irc_in' , line = line_no )
249+ func = self .search_func ('hook_modifier' , '["\' ]irc_in_([^"\' ]+)["\' ]' )
250+ for line_no , match in func :
251+ self .message ('warning' , 'modifier_irc_in' , line = line_no ,
252+ message = match .group (1 ))
253253
254254 def _check_signals_irc_out (self ):
255255 """Check if signals irc_out_xxx or irc_outtags_xxx are used."""
256- func = self .search_func ('hook_signal' , '["\' ][^"\' ]+,irc_out_' )
257- for line_no , _ in func :
258- self .message ('warning' , 'signal_irc_out' , line = line_no )
259- func = self .search_func ('hook_signal' , '["\' ][^"\' ]+,irc_outtags_' )
260- for line_no , _ in func :
261- self .message ('warning' , 'signal_irc_outtags' , line = line_no )
256+ func = self .search_func ('hook_signal' ,
257+ '["\' ][^"\' ]+,irc_out_([^"\' ]+)["\' ]' )
258+ for line_no , match in func :
259+ self .message ('warning' , 'signal_irc_out' , line = line_no ,
260+ message = match .group (1 ))
261+ func = self .search_func ('hook_signal' ,
262+ '["\' ][^"\' ]+,irc_outtags_([^"\' ]+)["\' ]' )
263+ for line_no , match in func :
264+ self .message ('warning' , 'signal_irc_outtags' , line = line_no ,
265+ message = match .group (1 ))
262266
263267 # === info ===
264268
@@ -274,8 +278,9 @@ def _check_weechat_site(self):
274278 r'(?:http://[w.]+weechat|https?://www.weechat)(?:\.org|\.net)' ,
275279 flags = re .IGNORECASE ,
276280 )
277- for line_no , link in links :
278- self .message ('info' , 'url_weechat' , line = line_no , link = link )
281+ for line_no , match in links :
282+ self .message ('info' , 'url_weechat' , line = line_no ,
283+ link = match .group ())
279284
280285 # run all checks, display report
281286
0 commit comments