Skip to content

Commit

Permalink
Simplify consistency check
Browse files Browse the repository at this point in the history
  • Loading branch information
suchow committed Apr 16, 2016
1 parent 9d1a016 commit 79f59d3
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions proselint/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,22 +264,13 @@ def consistency_check(text, word_pairs, err, msg, offset=0):

if len(match1) > 0 and len(match2) > 0:

if len(match1) > len(match2):
for m in match2:
errors.append((
m.start() + offset,
m.end() + offset,
err,
msg.format(m.group(0), w[0]),
None))
else:
for m in match1:
errors.append((
m.start() + offset,
m.end() + offset,
err,
msg.format(m.group(0), w[1]),
None))
for m in match2:
errors.append((
m.start() + offset,
m.end() + offset,
err,
msg.format(m.group(0), w[len(match1) <= len(match2)]),
None))

return errors

Expand Down

0 comments on commit 79f59d3

Please sign in to comment.