-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add --config cli argument (#1081)
Co-authored-by: Nytelife26 <xtylerjrx@gmail.com>
- Loading branch information
1 parent
f68a511
commit b4bca54
Showing
5 changed files
with
153 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"""Test user option overrides using --config and load_options""" | ||
import subprocess | ||
from proselint.tools import load_options | ||
|
||
|
||
def test_load_options_function(): | ||
"""Test load_options by specifying a user options path""" | ||
overrides = load_options("tests/test_config_flag_proselintrc") | ||
assert load_options()["checks"]["uncomparables.misc"] | ||
assert not overrides["checks"]["uncomparables.misc"] | ||
|
||
|
||
def test_load_fallbacks(): | ||
"""Test load_options with a fallback path""" | ||
fallbacks = load_options(None, ["tests/test_config_flag_proselintrc"]) | ||
assert not fallbacks["checks"]["uncomparables.misc"] | ||
fallbacks = load_options(None, ["./.proselintrc"]) | ||
assert fallbacks["checks"]["uncomparables.misc"] | ||
|
||
|
||
def test_config_flag(): | ||
"""Test the --config CLI argument""" | ||
output = subprocess.run(["python", "-m", "proselint", "--demo"], | ||
stdout=subprocess.PIPE, encoding='utf-8') | ||
assert "uncomparables.misc" in output.stdout | ||
output = subprocess.run(["python", "-m", "proselint", "--demo", "--config", | ||
"tests/test_config_flag_proselintrc"], | ||
stdout=subprocess.PIPE, encoding='utf-8') | ||
assert "uncomparables.misc" not in output.stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
{ | ||
"max_errors": 1000, | ||
"checks": { | ||
"airlinese.misc" : true, | ||
"annotations.misc" : true, | ||
"archaism.misc" : true, | ||
"cliches.hell" : true, | ||
"cliches.misc" : true, | ||
"consistency.spacing" : true, | ||
"consistency.spelling" : true, | ||
"corporate_speak.misc" : true, | ||
"cursing.filth" : true, | ||
"cursing.nfl" : false, | ||
"cursing.nword" : true, | ||
"dates_times.am_pm" : true, | ||
"dates_times.dates" : true, | ||
"hedging.misc" : true, | ||
"hyperbole.misc" : true, | ||
"jargon.misc" : true, | ||
"lexical_illusions.misc" : true, | ||
"lgbtq.offensive_terms" : true, | ||
"lgbtq.terms" : true, | ||
"links.broken" : false, | ||
"malapropisms.misc" : true, | ||
"misc.apologizing" : true, | ||
"misc.back_formations" : true, | ||
"misc.bureaucratese" : true, | ||
"misc.but" : true, | ||
"misc.capitalization" : true, | ||
"misc.chatspeak" : true, | ||
"misc.commercialese" : true, | ||
"misc.composition" : true, | ||
"misc.currency" : true, | ||
"misc.debased" : true, | ||
"misc.false_plurals" : true, | ||
"misc.illogic" : true, | ||
"misc.inferior_superior" : true, | ||
"misc.institution_name" : true, | ||
"misc.latin" : true, | ||
"misc.many_a" : true, | ||
"misc.metaconcepts" : true, | ||
"misc.metadiscourse" : true, | ||
"misc.narcissism" : true, | ||
"misc.not_guilty" : true, | ||
"misc.phrasal_adjectives" : true, | ||
"misc.preferred_forms" : true, | ||
"misc.pretension" : true, | ||
"misc.professions" : true, | ||
"misc.punctuation" : true, | ||
"misc.scare_quotes" : true, | ||
"misc.suddenly" : true, | ||
"misc.tense_present" : true, | ||
"misc.waxed" : true, | ||
"misc.whence" : true, | ||
"mixed_metaphors.misc" : true, | ||
"mondegreens.misc" : true, | ||
"needless_variants.misc" : true, | ||
"nonwords.misc" : true, | ||
"oxymorons.misc" : true, | ||
"psychology.misc" : true, | ||
"redundancy.misc" : true, | ||
"redundancy.ras_syndrome" : true, | ||
"skunked_terms.misc" : true, | ||
"spelling.able_atable" : true, | ||
"spelling.able_ible" : true, | ||
"spelling.athletes" : true, | ||
"spelling.em_im_en_in" : true, | ||
"spelling.er_or" : true, | ||
"spelling.in_un" : true, | ||
"spelling.misc" : true, | ||
"security.credit_card" : true, | ||
"security.password" : true, | ||
"sexism.misc" : true, | ||
"terms.animal_adjectives" : true, | ||
"terms.denizen_labels" : true, | ||
"terms.eponymous_adjectives" : true, | ||
"terms.venery" : true, | ||
"typography.diacritical_marks" : true, | ||
"typography.exclamation" : true, | ||
"typography.symbols" : true, | ||
"uncomparables.misc" : false, | ||
"weasel_words.misc" : true, | ||
"weasel_words.very" : true | ||
} | ||
} |