1212 paragraphs ,
1313)
1414
15-
1615all_checkers = {}
1716
1817
@@ -60,7 +59,10 @@ def check_missing_backtick_after_role(file, lines, options=None):
6059 error = rst .ROLE_MISSING_CLOSING_BACKTICK_RE .search (paragraph )
6160 if error :
6261 error_offset = paragraph [: error .start ()].count ("\n " )
63- yield paragraph_lno + error_offset , f"role missing closing backtick: { error .group (0 )!r} "
62+ yield (
63+ paragraph_lno + error_offset ,
64+ f"role missing closing backtick: { error .group (0 )!r} " ,
65+ )
6466
6567
6668_RST_ROLE_RE = re .compile ("``.+?``(?!`)." , flags = re .DOTALL )
@@ -129,8 +131,12 @@ def check_default_role(file, lines, options=None):
129131 before_match = line [: match .start ()]
130132 after_match = line [match .end () :]
131133 stripped_line = line .strip ()
132- if (stripped_line .startswith ("|" ) and stripped_line .endswith ("|" ) and
133- stripped_line .count ("|" ) >= 4 and "|" in match .group (0 )):
134+ if (
135+ stripped_line .startswith ("|" )
136+ and stripped_line .endswith ("|" )
137+ and stripped_line .count ("|" ) >= 4
138+ and "|" in match .group (0 )
139+ ):
134140 return # we don't handle tables yet.
135141 if _ends_with_role_tag (before_match ):
136142 # It's not a default role: it ends with a tag.
@@ -141,7 +147,10 @@ def check_default_role(file, lines, options=None):
141147 if match .group (0 ).startswith ("``" ) and match .group (0 ).endswith ("``" ):
142148 # It's not a default role: it's an inline literal.
143149 continue
144- yield lno , "default role used (hint: for inline literals, use double backticks)"
150+ yield (
151+ lno ,
152+ "default role used (hint: for inline literals, use double backticks)" ,
153+ )
145154
146155
147156@checker (".rst" , ".po" )
@@ -287,7 +296,10 @@ def check_role_with_double_backticks(file, lines, options=None):
287296 before = paragraph [: inline_literal .start ()]
288297 if _ends_with_role_tag (before ):
289298 error_offset = paragraph [: inline_literal .start ()].count ("\n " )
290- yield paragraph_lno + error_offset , "role use a single backtick, double backtick found."
299+ yield (
300+ paragraph_lno + error_offset ,
301+ "role use a single backtick, double backtick found." ,
302+ )
291303 paragraph = (
292304 paragraph [: inline_literal .start ()] + paragraph [inline_literal .end () :]
293305 )
@@ -308,9 +320,15 @@ def check_missing_space_before_role(file, lines, options=None):
308320 if match :
309321 error_offset = paragraph [: match .start ()].count ("\n " )
310322 if looks_like_glued (match ):
311- yield paragraph_lno + error_offset , f"missing space before role ({ match .group (0 )} )."
323+ yield (
324+ paragraph_lno + error_offset ,
325+ f"missing space before role ({ match .group (0 )} )." ,
326+ )
312327 else :
313- yield paragraph_lno + error_offset , f"role missing opening tag colon ({ match .group (0 )} )."
328+ yield (
329+ paragraph_lno + error_offset ,
330+ f"role missing opening tag colon ({ match .group (0 )} )." ,
331+ )
314332
315333
316334@checker (".rst" , ".po" )
@@ -494,4 +512,4 @@ def check_dangling_hyphen(file, lines, options):
494512 for lno , line in enumerate (lines ):
495513 stripped_line = line .rstrip ("\n " )
496514 if _has_dangling_hyphen (stripped_line ):
497- yield lno + 1 , f "Line ends with dangling hyphen"
515+ yield lno + 1 , "Line ends with dangling hyphen"
0 commit comments