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

add garner jargon and substitutions #1186

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions proselint/.proselintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"cursing.nword" : true,
"dates_times.am_pm" : true,
"dates_times.dates" : true,
"garner.jargon" : true,
"garner.substitutions" : true,
"hedging.misc" : true,
"hyperbole.misc" : true,
"jargon.misc" : true,
Expand Down
1 change: 1 addition & 0 deletions proselint/checks/garner/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Brian Garner recommendations from various sources."""
45 changes: 45 additions & 0 deletions proselint/checks/garner/jargon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
"""Brian Garner recommendations from various sources.

Resources:
Garner, Modern American Usage
Garner, Modern Legal Usage
Garner, Lawprose Blog
http://www.lawprose.org/lawprose-blog/
https://abajournal.com/magazine/article/ax_these_terms_from_your_legal_writing/

---
layout: post
source: Various Brian Garner sources
source_url: http://www.lawprose.org/lawprose-blog/
title: Brian Garner - Jargon
date: 2018-11-19 11:35:00
categories: writing
---

"""
from proselint.tools import memoize, existence_check


@memoize
def check(text):
"""Check the text."""
err = "garner.jargon"
msg = u"""'{}' may be jargon, legalese, or a redundancy."""

jargon = [
"acknowledge same",
"aid and abet",
"aid and comfort"
"conclusory",
"deem",
"each and every",
"for same",
"one and only",
"provided that",
"such",
"to same",
"witnesseth",
]

return existence_check(text, jargon, err, msg, join=True)
43 changes: 43 additions & 0 deletions proselint/checks/garner/substitutions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
"""Brian Garner recommended substitutions from various sources.

Resources:
Garner, Modern American Usage
Garner, Modern Legal Usage
Garner, Lawprose Blog
http://www.lawprose.org/lawprose-blog/
https://abajournal.com/magazine/article/ax_these_terms_from_your_legal_writing/

---
layout: post
source: Various Brian Garner sources
source_url: http://www.lawprose.org/lawprose-blog/
title: Brian Garner - Preferred Forms
date: 2018-11-19 13:35:00
categories: writing
---

"""

from proselint.tools import memoize, preferred_forms_check


@memoize
def check(text):
"""Suggest the preferred forms."""
err = "garner.substitutions"
msg = "Consider {}."

# https://abajournal.com/magazine/article/ax_these_terms_from_your_legal_writing
preferences = [
["'or'", [r"and(/| )or"]],
["'are'", ["deem"]],
["'if', 'except' or 'also'", ["(provided that|given that)"]],
["'let it be known' or 'understand'", [
r"know all (women|men|persons) by these presents"]],
["'in this [agreement, section, etc]", ["herein"]],
["'must,' 'should,' 'is,' 'will,' or 'may'", ["shall"]],
["'required by''", ["pursuant to"]],
]

return preferred_forms_check(text, preferences, err, msg)
24 changes: 24 additions & 0 deletions tests/test_garner_jargon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Tests for garner.jargon check."""
from __future__ import absolute_import

from proselint.checks.garner import jargon as chk

from .check import Check


class TestCheck(Check):
"""The test class for garner.jargon."""

__test__ = True

@property
def this_check(self):
"""Boilerplate."""
return chk

@property
def test_smoke(self):
"""Basic smoke test for garner.jargon."""
assert self.passes("""This sentence contains no jargon.""")
assert not self.passes("""Whereas this conclusory sentence contains
jargon.""")
25 changes: 25 additions & 0 deletions tests/test_garner_substitutions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Tests for garner.jargon check."""
from __future__ import absolute_import

from proselint.checks.garner import substitutions as chk

from .check import Check


class TestCheck(Check):
"""The test class for garner.substitutions"""

__test__ = True

@property
def this_check(self):
"""Boilerplate."""
return chk

@property
def test_smoke(self):
"""Basic smoke test for garner.substitutions."""
assert self.passes("""This sentence should pass.""")
assert not self.passes("""Herein we agree on the agreement at issue in
the above-captioned case, provided, however, that all parties have no
objections to same.""")