Skip to content

Commit

Permalink
refactor: use existence_check for uncomparables
Browse files Browse the repository at this point in the history
  • Loading branch information
Nytelife26 committed May 17, 2021
1 parent 6d8c5d9 commit 0745774
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions proselint/checks/uncomparables/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
attention and expects you to have done the same.
"""
import re
from proselint.tools import memoize
from proselint.tools import existence_check, memoize
import itertools


Expand Down Expand Up @@ -114,9 +114,7 @@ def check(text):
("more", "possible") # FIXME
]

all = [fr"(^|\W){i[0]}\s{i[1]}[\W$]" for i in itertools.product(
comparators, uncomparables) if i not in exceptions]
uncomparables = [fr"{i[0]}\s{i[1]}" for i in itertools.product(
comparators, uncomparables) if i not in exceptions]

occ = re.finditer("|".join(all), text.lower())
return [(o.start(), o.end(), err, msg.format(o.group(0)), None)
for o in occ]
return existence_check(text, uncomparables, err, msg, require_padding=True)

0 comments on commit 0745774

Please sign in to comment.