Skip to content

Commit f4742c6

Browse files
committed
refactor: use iterator expression
1 parent ed6aca2 commit f4742c6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

proselint/checks/misc/but.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,20 @@
2323

2424

2525
def _check_but_paragraphs(text: str, check: Check) -> Iterator[CheckResult]:
26-
for m in re.finditer(PATTERN, text):
27-
count = m.group(0).count("\n", 0, 2)
28-
yield CheckResult(
29-
start_pos=m.start() + count + check.offset[0],
26+
return (
27+
CheckResult(
28+
start_pos=(
29+
m.start()
30+
+ m.group(0).count("\n", 0, 2)
31+
+ check.offset[0]
32+
),
3033
end_pos=m.end(),
3134
check_path=check.path,
3235
message=check.message,
3336
replacements=None,
3437
)
38+
for m in re.finditer(PATTERN, text)
39+
)
3540

3641

3742
check = Check(

0 commit comments

Comments
 (0)