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

Exclamation point warning on all caps text #540

Closed
CatherineH opened this issue Jul 22, 2016 · 4 comments
Closed

Exclamation point warning on all caps text #540

CatherineH opened this issue Jul 22, 2016 · 4 comments

Comments

@CatherineH
Copy link
Contributor

I am using proselint 0.6.0 with python 3.5. I have the following sample text:

Hello, yes I AM A DOG.
proselint rules!!!!!

This produces the proselint warning:

$ proselint proselint_test.txt 
proselint_test.txt:1:11: leonard.exclamation.multiple Stop yelling. Keep your exclamation points under control.
proselint_test.txt:2:11: hyperbolic.misc 'rules!!!!!' is hyperbolic.

It seems like leonard.exclamation.multiple is catching multiple capitalized words rather than exclamation points, so it is confusing that it warns me about the latter.

@joshmgrant
Copy link
Contributor

I'm able to reproduce this in 0.6.1 with Python 2.7. It looks like a bug, either an incorrect error message or incorrect logic in the check.

@suchow suchow added the bug label Jul 22, 2016
@suchow
Copy link
Member

suchow commented Jul 22, 2016

Here's the relevant code:


@memoize
def check_repeated_exclamations(text):
    """Check the text."""
    err = "leonard.exclamation.multiple"
    msg = u"Stop yelling. Keep your exclamation points under control."

    regex = r"[^A-Z]\b((\s[A-Z]+){3,})"

    return existence_check(
        text, [regex], err, msg, require_padding=False, ignore_case=False,
        max_errors=1, dotall=True)

You're right, this is incorrect — it's checking for > 2 sequential all-caps words, not > 1 sequential exclamation points.

Good catch.

@suchow
Copy link
Member

suchow commented Jul 22, 2016

(The fix is to alter the regex to match 2+ sequential exclamation points.)

alexyorke pushed a commit that referenced this issue Jul 27, 2016
@alexyorke alexyorke mentioned this issue Jul 27, 2016
@mpacer
Copy link
Member

mpacer commented Jul 27, 2016

Thank you @CatherineH for letting us know!

Would you pull @decagon's fix and test it to make sure it now works appropriately on your build?

Also, @CatherineH, would you be willing to write a test for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants