12
12
paragraphs ,
13
13
)
14
14
15
-
16
15
all_checkers = {}
17
16
18
17
@@ -60,7 +59,10 @@ def check_missing_backtick_after_role(file, lines, options=None):
60
59
error = rst .ROLE_MISSING_CLOSING_BACKTICK_RE .search (paragraph )
61
60
if error :
62
61
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
+ )
64
66
65
67
66
68
_RST_ROLE_RE = re .compile ("``.+?``(?!`)." , flags = re .DOTALL )
@@ -129,8 +131,12 @@ def check_default_role(file, lines, options=None):
129
131
before_match = line [: match .start ()]
130
132
after_match = line [match .end () :]
131
133
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
+ ):
134
140
return # we don't handle tables yet.
135
141
if _ends_with_role_tag (before_match ):
136
142
# It's not a default role: it ends with a tag.
@@ -141,7 +147,10 @@ def check_default_role(file, lines, options=None):
141
147
if match .group (0 ).startswith ("``" ) and match .group (0 ).endswith ("``" ):
142
148
# It's not a default role: it's an inline literal.
143
149
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
+ )
145
154
146
155
147
156
@checker (".rst" , ".po" )
@@ -287,7 +296,10 @@ def check_role_with_double_backticks(file, lines, options=None):
287
296
before = paragraph [: inline_literal .start ()]
288
297
if _ends_with_role_tag (before ):
289
298
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
+ )
291
303
paragraph = (
292
304
paragraph [: inline_literal .start ()] + paragraph [inline_literal .end () :]
293
305
)
@@ -308,9 +320,15 @@ def check_missing_space_before_role(file, lines, options=None):
308
320
if match :
309
321
error_offset = paragraph [: match .start ()].count ("\n " )
310
322
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
+ )
312
327
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
+ )
314
332
315
333
316
334
@checker (".rst" , ".po" )
@@ -494,4 +512,4 @@ def check_dangling_hyphen(file, lines, options):
494
512
for lno , line in enumerate (lines ):
495
513
stripped_line = line .rstrip ("\n " )
496
514
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