How to use the proselint.tools.existence_check function in proselint

To help you get started, we’ve selected a few proselint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github amperser / proselint / tests / test_existence_check.py View on Github external
def test_multiple_matches(self):
        """Test that multiple matches are found correctly."""
        assert len(
            chk("""abc and abc are as easy as 123""",
                self.l, self.err, self.msg)) == 2
        assert len(
            chk("""ABC and abc are as easy as 123""",
                self.l, self.err, self.msg, ignore_case=True)) == 2
        assert chk(
            """abcabc are easy as 123""", self.l, self.err, self.msg) == []
github amperser / proselint / proselint / checks / typography / symbols.py View on Github external
def check_multiplication_symbol(text):
    u"""Use the multiplication symbol ×, not the lowercase letter x."""
    err = "typography.symbols.multiplication_symbol"
    msg = u"Use the multiplication symbol ×, not the letter x."
    regex = "[0-9]+ ?x ?[0-9]+"

    return existence_check(
        text, [regex], err, msg, max_errors=3, require_padding=False)
github amperser / proselint / proselint / checks / misc / false_plurals.py View on Github external
def check_kudos(text):
    """Check the text."""
    err = "misc.false_plurals.kudos"
    msg = u"Kudos is singular."

    return existence_check(text, ["many kudos"], err, msg)
github amperser / proselint / proselint / checks / corporate_speak / misc.py View on Github external
"no brainer",
        "par for the course",
        "bang for your buck",
        "synergy",
        "move the goal post",
        "apples to apples",
        "win-win",
        "circle back around",
        "all hands on deck",
        "take this offline",
        "drill-down",
        "elephant in the room",
        "on my plate",
    ]

    return existence_check(text, list, err, msg, ignore_case=True)
github amperser / proselint / proselint / checks / misc / airlinese.py View on Github external
def check(text):
    """Check the text."""
    err = "misc.airlinese"
    msg = u"'{}' is airlinese."

    airlinese = [
        "enplan(?:e|ed|ing|ement)",
        "deplan(?:e|ed|ing|ement)",
        "taking off momentarily",
    ]

    return existence_check(text, airlinese, err, msg)
github amperser / proselint / proselint / checks / typography / symbols.py View on Github external
def check_sentence_spacing(text):
    """Use no more than two spaces after a period."""
    err = "typography.symbols.sentence_spacing"
    msg = u"More than two spaces after the period; use 1 or 2."
    regex = "\. {3}"

    return existence_check(
        text, [regex], err, msg, max_errors=3, require_padding=False)
github amperser / proselint / proselint / checks / misc / bureaucratese.py View on Github external
def check(text):
    """Check the text."""
    err = "misc.bureaucratese"
    msg = u"'{}' is bureaucratese."

    bureaucratese = [
        "meet with your approval",
        "meets with your approval",
    ]

    return existence_check(text, bureaucratese, err, msg, join=True)
github amperser / proselint / proselint / checks / misc / jargon.py View on Github external
def check(text):
    """Check the text."""
    err = "misc.jargon"
    msg = u"'{}' is jargon. Can you replace it with something more standard?"

    jargon = [
        "in the affirmative",
        "in the negative",
        "agendize",
        "per your order",
        "per your request",
        "disincentivize",
    ]

    return existence_check(text, jargon, err, msg, join=True)
github amperser / proselint / proselint / checks / hyperbole / misc.py View on Github external
def check(text):
    """Check the text."""
    err = "hyperbolic.misc"
    msg = u"'{}' is hyperbolic."

    words = [
        "[a-z]*[!]{2,}",
        "[a-z]*\?{2,}"
    ]

    return existence_check(text, words, err, msg)
github amperser / proselint / proselint / checks / security / credit_card.py View on Github external
def check(text):
    """Check the text."""
    err = "security.credit_card"
    msg = u"Don't put credit card numbers in plain text."

    credit_card_numbers = [
        "4\d{15}",
        "5[1-5]\d{14}",
        "3[4,7]\d{13}",
        "3[0,6,8]\d{12}",
        "6011\d{12}",
    ]

    return existence_check(text, credit_card_numbers, err, msg)