diff --git a/proselint/checks/cliches/misc.py b/proselint/checks/cliches/misc.py index ac8c51f0a..8a810a91e 100644 --- a/proselint/checks/cliches/misc.py +++ b/proselint/checks/cliches/misc.py @@ -922,7 +922,7 @@ def check_cliches_gnu_diction(text: str) -> list[ResultCheck]: return existence_check(text, items, err, msg, ignore_case=True) -def check_cliches_nigel(text): +def check_cliches_nigel(text: str) -> list[ResultCheck]: """Check the text. source: Nigel Ree's Dictionary of Cliches diff --git a/proselint/config_base.py b/proselint/config_base.py index d1277b4f3..97e6bd4e2 100644 --- a/proselint/config_base.py +++ b/proselint/config_base.py @@ -79,6 +79,7 @@ def names(cls) -> list[str]: "nonwords.misc": True, "oxymorons.misc": True, "psychology.misc": True, + "punctuation_spacing.misc": True, "redundancy.misc": True, "redundancy.ras_syndrome": True, "skunked_terms.misc": True, diff --git a/proselint/tools.py b/proselint/tools.py index 482ac34e9..618c4536e 100644 --- a/proselint/tools.py +++ b/proselint/tools.py @@ -182,50 +182,10 @@ def lint_path( results = {} chars = 0 - msg = " ".join(msg.split()) - - for w in word_pairs: - matches = [ - [m for m in re.finditer(w[0], text)], - [m for m in re.finditer(w[1], text)] - ] - - if len(matches[0]) > 0 and len(matches[1]) > 0: - - idx_minority = len(matches[0]) > len(matches[1]) - - for m in matches[idx_minority]: - errors.append(( - m.start() + offset, - m.end() + offset, - err, - msg.format(w[~idx_minority], m.group(0)), - w[~idx_minority])) - - return errors - - -def punctuation_check(text, pattern, err, msg, offset=0): - """Build a checker for unnacceptable number of spaces behind puncuation.""" - errors = [] - - period_spaces = re.finditer(pattern, text) - - for inst in period_spaces: - errors.append(( - inst.start() + offset, - inst.end() + offset, - err, - msg, - None)) - - return errors - - -def preferred_forms_check(text, list, err, msg, ignore_case=True, offset=0): - """Build a checker that suggests the preferred form.""" - if ignore_case: - flags = re.IGNORECASE + if len(paths) == 0: + # Use stdin if no paths were specified + log.info("No path specified -> will read from ") + results[""] = lint(sys.stdin, config=config, checks=checks) else: # offer "outer" executor, to make multiprocessing more effective exe = ProcessPoolExecutor() if config["parallelize"] else None diff --git a/tests/test_config_flag_proselintrc b/tests/test_config_flag_proselintrc deleted file mode 100644 index d0982baa4..000000000 --- a/tests/test_config_flag_proselintrc +++ /dev/null @@ -1,90 +0,0 @@ -{ - "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.ally_ly" : true, - "spelling.ance_ence" : true, - "spelling.athletes" : true, - "spelling.ely_ly" : true, - "spelling.em_im_en_in" : true, - "spelling.er_or" : true, - "spelling.in_un" : true, - "spelling.misc" : true, - "spelling.ve_of" : 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, - "punctuation_spacing.punctuation_spacing" : true - } -}