Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kill newline characters and whitespace in errors #289

Merged
merged 1 commit into from
Feb 19, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions proselint/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ def line_and_column(text, position):
def consistency_check(text, word_pairs, err, msg, offset=0):
"""Build a consistency checker for the given word_pairs."""
errors = []

msg = " ".join(msg.split())

for w in word_pairs:
match1 = [m for m in re.finditer(w[0], text)]
match2 = [m for m in re.finditer(w[1], text)]
Expand Down Expand Up @@ -111,6 +114,8 @@ def preferred_forms_check(text, list, err, msg, ignore_case=True, offset=0):
else:
flags = 0

msg = " ".join(msg.split())

errors = []
regex = u"[\W^]{}[\W$]"
for p in list:
Expand All @@ -133,6 +138,8 @@ def existence_check(text, list, err, msg, ignore_case=True,
"""Build a checker that blacklists certain words."""
flags = 0

msg = " ".join(msg.split())

if ignore_case:
flags = flags | re.IGNORECASE

Expand Down