Skip to content

Commit

Permalink
Implement linting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Serene-Arc committed May 30, 2021
1 parent 10f71f7 commit 47a872b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions proselint/checks/redundancy/adverb_dialogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
from proselint.tools import memoize, is_quoted
import re


@memoize
def check(text):
"""Suggest the preferred forms"""
"""Suggest the preferred forms."""
err = "redundancy.adverbdialogue"
msg = "Redundant adverb. Remove {}."

# find if any of the text is in quote
regex = '[\'"].*[,?!][\'"][\s\w]*?(\w+?ly)[\s\w]*[,.!?]'
matches = re.finditer(regex,text)
return [(match.start(1), match.end(1), err, msg.format(match.groups(0)[0]), None) for match in matches]
regex = r'[\'"].*[,?!][\'"][\s\w]*?(\w+?ly)[\s\w]*[,.!?]'
matches = re.finditer(regex, text)
return [(match.start(1), match.end(1), err, msg.format(
match.groups(0)[0]), None) for match in matches]

0 comments on commit 47a872b

Please sign in to comment.