Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat(core): a good helping of new Weir rules (#2710)
Elijah Pottere44b58c0b5cb
diff --git a/harper-core/src/linting/weir_rules/AllReady.weir b/harper-core/src/linting/weir_rules/AllReady.weirnew file mode 100644index 000000000..4cdad640e--- /dev/null+++ b/harper-core/src/linting/weir_rules/AllReady.weir@@ -0,0 +1,32 @@+expr main <(all ready ADJ), (all ready)>++let message "Use `already` before adjectives instead of the two-word phrase."+let description "Flags `all ready` when it precedes an adjective so the adverb `already` can take its place."+let kind "Grammar"+let becomes "already"++# True positives+test "The device is all ready available in Korea." "The device is already available in Korea."+test "Everything is all ready clear before the deadline." "Everything is already clear before the deadline."+test "The firmware is all ready stable on the new hardware." "The firmware is already stable on the new hardware."+test "They were all ready aware of the security policy." "They were already aware of the security policy."+test "Our team is all ready excited to release the patch." "Our team is already excited to release the patch."+test "It is all ready possible to switch to the new plan." "It is already possible to switch to the new plan."+test "The training is all ready complete for the next cohort." "The training is already complete for the next cohort."+test "Her notes are all ready relevant to the presentation." "Her notes are already relevant to the presentation."+test "The content is all ready public on the blog." "The content is already public on the blog."+test "ALL READY AVAILABLE data arrived yesterday." "ALREADY AVAILABLE data arrived yesterday."+test "The settings are all ready consistent across environments." "The settings are already consistent across environments."+test "Our docs are all ready accurate for the release notes." "Our docs are already accurate for the release notes."++# False negatives (these contexts still need the correction)+test "All ready solid documentation should go live soon." "Already solid documentation should go live soon."+test "The plan is all ready steady for roll out." "The plan is already steady for roll out."+test "The board felt all ready confident in the direction." "The board felt already confident in the direction."++# Guardrails / False positives (these should remain untouched)+test "Are you all ready for the show?" "Are you all ready for the show?"+test "We were all ready to leave as soon as the bell rang." "We were all ready to leave as soon as the bell rang."+test "Your crew was all ready and waiting for the signal." "Your crew was all ready and waiting for the signal."+test "You can keep all ready supplies in the closet." "You can keep all ready supplies in the closet."+test "I saw that they were all ready when the curtains opened." "I saw that they were all ready when the curtains opened."diff --git a/harper-core/src/linting/weir_rules/AllThough.weir b/harper-core/src/linting/weir_rules/AllThough.weirnew file mode 100644index 000000000..12db514bf--- /dev/null+++ b/harper-core/src/linting/weir_rules/AllThough.weir@@ -0,0 +1,24 @@+expr main all though++let message "Merge `all` and `though` into the conjunction `although`."+let description "Nobody means to write the two-word phrase `all though` when the single word `although` is intended."+let kind "Typo"+let becomes "although"+let strategy "Exact"+test "All though I liked the book, I had to stop reading it." "although I liked the book, I had to stop reading it."+test "all though the schedule is tight, I'll try." "although the schedule is tight, I'll try."+test "ALL THOUGH the rules are set, we questioned them." "although the rules are set, we questioned them."+test "All Though we planned carefully, things shifted." "although we planned carefully, things shifted."+test "He kept asking all though she already declined." "He kept asking although she already declined."+test "All though." "although."+test "Everyone cheered all though the score was clear." "Everyone cheered although the score was clear."+test "All though, the pilot stayed calm." "although, the pilot stayed calm."+test "All though they tried, the system failed." "although they tried, the system failed."+test "All though the evidence is sparse, the team persisted." "although the evidence is sparse, the team persisted."+test "All though we expect the meeting to end early, we prepared backup." "although we expect the meeting to end early, we prepared backup."+test "All, though, the plan still faltered." "All, though, the plan still faltered."+test "We covered all the parts, though, until the hour." "We covered all the parts, though, until the hour."+test "She knows all of the relevant rules though." "She knows all of the relevant rules though."+test "Although we disagree, this is still valid." "Although we disagree, this is still valid."+test "He said all of his reasons, though it was long." "He said all of his reasons, though it was long."+test "They discussed all of the topics, though briefly." "They discussed all of the topics, though briefly."diff --git a/harper-core/src/linting/weir_rules/ArriveOnWeekday.weir b/harper-core/src/linting/weir_rules/ArriveOnWeekday.weirnew file mode 100644index 000000000..2722fbb1c--- /dev/null+++ b/harper-core/src/linting/weir_rules/ArriveOnWeekday.weir@@ -0,0 +1,44 @@+expr weekdays [Monday, Mon, Tuesday, Tue, Wednesday, Wed, Thursday, Thu, Thur, Thurs, Friday, Fri, Saturday, Sat, Sunday, Sun]+expr arriveWeekdayGap <(arrive @weekdays), ( )>+expr main @arriveWeekdayGap++let message "Add 'on' after 'arrive' when it is immediately followed by a weekday."+let description "Keeps schedules explicit by preferring the familiar `arrive on Friday` pattern instead of a bare weekday."+let kind "Style"+let becomes " on "++# true positives++# weekday spelled out+test "I plan to arrive Monday afternoon." "I plan to arrive on Monday afternoon."++# abbreviated day+test "Please arrive Tue before noon." "Please arrive on Tue before noon."++test "Make sure we arrive Thursday prepared." "Make sure we arrive on Thursday prepared."++test "Arrive fri if you want to join." "Arrive on fri if you want to join."++test "arrive SUN this time around." "arrive on SUN this time around."++test "arrive Wed, I mean it." "arrive on Wed, I mean it."++test "We should arrive Mon and start with the briefing." "We should arrive on Mon and start with the briefing."++test "He asked if we could arrive Thurs for setup." "He asked if we could arrive on Thurs for setup."++test "Arrive Tue, please." "Arrive on Tue, please."++# true negatives and guardrails++test "Please arrive on Monday." "Please arrive on Monday."++test "We can arrive tomorrow." "We can arrive tomorrow."++test "Arrive after Monday to avoid traffic." "Arrive after Monday to avoid traffic."++test "Arrive Monday's crew already left." "Arrive Monday's crew already left."++test "They plan to arrive in May." "They plan to arrive in May."++test "Arrive before noon, so we can prep." "Arrive before noon, so we can prep."diff --git a/harper-core/src/linting/weir_rules/BlacklistWhitelist.weir b/harper-core/src/linting/weir_rules/BlacklistWhitelist.weirnew file mode 100644index 000000000..1527c62d4--- /dev/null+++ b/harper-core/src/linting/weir_rules/BlacklistWhitelist.weir@@ -0,0 +1,27 @@+expr colors [black, white]+expr items [list, lists]++expr main @colors @items++let message "Treat color-based deny/allow lists as single words like `blacklist` or `whitelist`."+let description "Normalize the two-word sequence `black list`/`white list` so it matches the established compound noun or verb."+let kind "Usage"+let becomes ["blacklist", "whitelist"]++# True positives+test "We need to black list that vendor." "We need to blacklist that vendor."+test "I told the compliance team to white list our partners." "I told the compliance team to whitelist our partners."+test "Black list suspicious spikes before the release." "Blacklist suspicious spikes before the release."+test "White list the new IPs before the demo." "Whitelist the new IPs before the demo."+test "Do not black list folks lightly." "Do not blacklist folks lightly."+test "Please white list those domains." "Please whitelist those domains."+test "The policy will black list multiple addresses." "The policy will blacklist multiple addresses."+test "White list the staging nodes before testing." "Whitelist the staging nodes before testing."+test "Black list any host that misbehaves." "Blacklist any host that misbehaves."+test "White list their servers before the big push." "Whitelist their servers before the big push."++# False positives / true negatives+allows "The color black is on this list."+allows "Please keep the list of white items up to date."+allows "The existing blacklist already contains these values."+allows "We've been using whitelist entries for weeks."diff --git a/harper-core/src/linting/weir_rules/ClickThroughRate.weir b/harper-core/src/linting/weir_rules/ClickThroughRate.weirnew file mode 100644index 000000000..765dbf3a7--- /dev/null+++ b/harper-core/src/linting/weir_rules/ClickThroughRate.weir@@ -0,0 +1,31 @@+expr metricHeads [click, view]+expr metricNouns [rate, rates, conversion, conversions, optimization, optimizations]+expr main <((@metricHeads through) @metricNouns), (@metricHeads through)>++let message "Keep the metric modifier bonded so the compound explicitly names the analytics signal."+let description "Hyphenates the verb+preposition pair when it directly precedes rate-style nouns, mirroring how these terms are commonly styled in analytics writing."+let kind "Punctuation"+let becomes ["click-through", "view-through"]+let strategy "MatchCase"++# True positives+# These sequences should become hyphenated because they describe a compound metric modifier.+test "The click through rate improved." "The click-through rate improved."+test "Our click through rates are trending up." "Our click-through rates are trending up."+test "We monitor the click through conversion for each campaign." "We monitor the click-through conversion for each campaign."+test "Click through conversions kept climbing overnight." "Click-through conversions kept climbing overnight."+test "A sudden click through optimization push arrived." "A sudden click-through optimization push arrived."+test "The latest click through rate dashboard arrived." "The latest click-through rate dashboard arrived."+test "click through conversions stay on the board." "click-through conversions stay on the board."+test "CLICK THROUGH RATES stay on the board." "CLICK-THROUGH RATES stay on the board."+test "After the launch, the click through conversion number improved." "After the launch, the click-through conversion number improved."+test "The view through optimization performed well." "The view-through optimization performed well."++# False positives / true negatives+# Keep the rule from firing when the modifier simply describes a navigation action or lacks a metric noun.+test "Click through the next tab when ready." "Click through the next tab when ready."+test "We click through every data point before shipping." "We click through every data point before shipping."+test "Please click through the menu options slowly." "Please click through the menu options slowly."+test "If you click through this screen, let me know." "If you click through this screen, let me know."+test "She needs to view through the samples before approving." "She needs to view through the samples before approving."+test "Click through, at your leisure, to see the preview." "Click through, at your leisure, to see the preview."diff --git a/harper-core/src/linting/weir_rules/ComprisesOf.weir b/harper-core/src/linting/weir_rules/ComprisesOf.weirnew file mode 100644index 000000000..73ac8fcd4--- /dev/null+++ b/harper-core/src/linting/weir_rules/ComprisesOf.weir@@ -0,0 +1,26 @@+expr main (comprises of)++let message "Avoid `comprises of`; let `comprises` stand on its own or choose `consists of`."+let description "`Comprises` already contains the notion of `of`, so following it with another `of` is redundant."+let kind "Usage"+let becomes ["comprises", "is comprised of"]++test "The playlist comprises of twelve tracks." "The playlist comprises twelve tracks."+test "Our team comprises of specialists with diverse expertise." "Our team comprises specialists with diverse expertise."+test "The committee comprises of members from each department." "The committee comprises members from each department."+test "The community comprises of volunteers and donors." "The community comprises volunteers and donors."+test "The project comprises of multiple modules." "The project comprises multiple modules."+test "The project comprises of multiple modules." "The project is comprised of multiple modules."+test "His speech comprises of anecdotes." "His speech comprises anecdotes."+test "This portfolio comprises of leading companies." "This portfolio comprises leading companies."+test "Comprises of rare objects, the exhibit feels curated." "Comprises rare objects, the exhibit feels curated."+test "COMPRISES OF outdated references, the memo loses credibility." "COMPRISES outdated references, the memo loses credibility."++test "The team comprises consultants from all regions." "The team comprises consultants from all regions."+test "Her summary comprises a list of skills." "Her summary comprises a list of skills."+test "The board comprises directors of multiple backgrounds." "The board comprises directors of multiple backgrounds."+test "It comprises a mix of fans and critics." "It comprises a mix of fans and critics."+test "I know what comprises the committee." "I know what comprises the committee."+test "A phrase like comprises-of should stay untouched." "A phrase like comprises-of should stay untouched."+test "Comprising the look of the thing, the design stands out." "Comprising the look of the thing, the design stands out."+test "The comprise of energy issues is complex." "The comprise of energy issues is complex."diff --git a/harper-core/src/linting/weir_rules/DuringAges.weir b/harper-core/src/linting/weir_rules/DuringAges.weirnew file mode 100644index 000000000..2fe013ae7--- /dev/null+++ b/harper-core/src/linting/weir_rules/DuringAges.weir@@ -0,0 +1,27 @@+expr main <((during ages) ![NUM, :]), (during)>++let message "Use `for ages` instead of `during ages` when referring to a vague stretch of time."+let description "The idiomatic duration is 'for ages', so swap the initial preposition whenever the words refer to a general span."+let kind "Usage"+let becomes "for"+let strategy "MatchCase"++# True positives+# Replace `during ages` with `for ages` when the phrase describes a vague stretch of time.+test "Stories accumulate during ages past." "Stories accumulate for ages past."+test "During ages of exile, they remained resolute." "For ages of exile, they remained resolute."+test "She waited during ages for the letter." "She waited for ages for the letter."+test "We have been friends during ages long." "We have been friends for ages long."+test "During ages gone by, the valley slept." "For ages gone by, the valley slept."+test "People argued during ages on behalf of the plan." "People argued for ages on behalf of the plan."+test "During ages past, kings ruled here." "For ages past, kings ruled here."+test "I reminisced during ages about the river." "I reminisced for ages about the river."+test "During ages of waiting he kept faith." "For ages of waiting he kept faith."+test "Why do you speak during ages like that?" "Why do you speak for ages like that?"+test "During ages after the fall they rebuilt." "For ages after the fall they rebuilt."+test "She sang during ages when storms howled." "She sang for ages when storms howled."++# Guardrails+# Numeric age ranges should remain untouched.+# Keep the precise age range framing.+allows "During ages: 35 to 40, we recorded the decline."diff --git a/harper-core/src/linting/weir_rules/EagleEyed.weir b/harper-core/src/linting/weir_rules/EagleEyed.weirnew file mode 100644index 000000000..c83be8350--- /dev/null+++ b/harper-core/src/linting/weir_rules/EagleEyed.weir@@ -0,0 +1,31 @@+expr main (eagle eyed)++let message "Hyphenate `eagle eyed` when it acts as a single adjective before a noun."+let description "Treats the phrase as a compound modifier and replaces the space with a hyphen so it reads like one idea."+let kind "Punctuation"+let becomes "eagle-eyed"+let strategy "MatchCase"++# True positives+# Ensure the hyphen appears before a noun when `eagle eyed` describes it.+test "The eagle eyed analyst noticed the bug." "The eagle-eyed analyst noticed the bug."+test "Our eagle eyed intern flagged the missing reference." "Our eagle-eyed intern flagged the missing reference."+test "An eagle eyed reviewer spotted the mismatch." "An eagle-eyed reviewer spotted the mismatch."+test "Eagle eyed mentors guide the new hires." "Eagle-eyed mentors guide the new hires."+test "That eagle eyed editor catches grammar slips." "That eagle-eyed editor catches grammar slips."+test "I rely on eagle eyed assistants for QA." "I rely on eagle-eyed assistants for QA."+test "Her eagle eyed focus kept the doc clean." "Her eagle-eyed focus kept the doc clean."+test "Late-night eagle eyed editors keep releases stable." "Late-night eagle-eyed editors keep releases stable."+test "Eagle eyed scientists double-check the data." "Eagle-eyed scientists double-check the data."+test "The eagle eyed security team audits every deploy." "The eagle-eyed security team audits every deploy."+test "Our eagle eyed partner shared the warning." "Our eagle-eyed partner shared the warning."+test "He admired their eagle eyed vigilance." "He admired their eagle-eyed vigilance."++# False negatives (capitalization should not stop the correction)+test "Eagle Eyed reviewers always respond quickly." "Eagle-Eyed reviewers always respond quickly."+test "EAGLE EYED surveyors noticed the shift." "EAGLE-EYED surveyors noticed the shift."+test "An Eagle Eyed champion kept tabs on the data." "An Eagle-Eyed champion kept tabs on the data."++# True negatives / false positives+allows "Eagle-eyed editors already finished the article."+allows "The eagle eyedness they display is a point of pride."diff --git a/harper-core/src/linting/weir_rules/GoggleBrand.weir b/harper-core/src/linting/weir_rules/GoggleBrand.weirnew file mode 100644index 000000000..d33389282--- /dev/null+++ b/harper-core/src/linting/weir_rules/GoggleBrand.weir@@ -0,0 +1,28 @@+expr googleMispellings [goggle, googol]+expr main <(@googleMispellings [ads, analytics, calendar, chrome, classroom, docs, drive, forms, hangouts, mail, maps, news, photos, search, sheets, slides, translate, workspace]), @googleMispellings>++let message "You probably meant to spell the company name `Google`."+let description "Replaces the misspelling `goggle` when it is paired with a well-known Google service."+let kind "Typo"+let becomes "Google"+let strategy "Exact"++test "goggle docs keeps syncing in the background." "Google docs keeps syncing in the background."+test "GOGGLE analytics shows the same anomaly." "Google analytics shows the same anomaly."+test "I bookmarked the goggle maps route for tomorrow." "I bookmarked the Google maps route for tomorrow."+test "Please open goggle slides before the meeting." "Please open Google slides before the meeting."+test "We archived the goggle forms responses for later." "We archived the Google forms responses for later."+test "The goggle drive link expired yesterday." "The Google drive link expired yesterday."+test "His goggle search history is a little wild." "His Google search history is a little wild."+test "Goggle workspace just announced a redesign." "Google workspace just announced a redesign."+test "goggle mail and goggle calendar both flagged the alert." "Google mail and Google calendar both flagged the alert."+test "Send the screenshot to goggle photos support." "Send the screenshot to Google photos support."+test "Send the screenshot to googol photos support." "Send the screenshot to Google photos support."++test "She wore a goggle when swimming." "She wore a goggle when swimming."+test "The archaeologist examined the ancient goggle carefully." "The archaeologist examined the ancient goggle carefully."+test "This goggle strap needs tightening." "This goggle strap needs tightening."+test "Goggle is a brand of swimwear." "Goggle is a brand of swimwear."+test "Let's goggle the data and see what pops up." "Let's goggle the data and see what pops up."+test "Goggles help keep sand out of the eyes." "Goggles help keep sand out of the eyes."+diff --git a/harper-core/src/linting/weir_rules/ImitateFrom.weir b/harper-core/src/linting/weir_rules/ImitateFrom.weirnew file mode 100644index 000000000..53452a6d4--- /dev/null+++ b/harper-core/src/linting/weir_rules/ImitateFrom.weir@@ -0,0 +1,30 @@+expr imitateVerbs [imitate, imitates, imitated, imitating]++expr main <([(@imitateVerbs * from *), (@imitateVerbs * from * *), (@imitateVerbs * from * * *), (@imitateVerbs * * from *), (@imitateVerbs * * from * *), (@imitateVerbs * * from * * *), (@imitateVerbs * * * from *), (@imitateVerbs * * * from * *), (@imitateVerbs * * * from * * *), (@imitateVerbs * * * * from *), (@imitateVerbs * * * * from * *), (@imitateVerbs * * * * from * * *)]), (from)>++let message "Use `of` with `imitate` when naming the source you copy."+let description "After `imitate ...`, idiomatic phrasing points to the inspiration with `of` instead of `from`."+let kind "Usage"+let becomes "of"++# True positives+test "They imitate the rhythm from their mentor." "They imitate the rhythm of their mentor."+test "She imitates every gesture from her teacher." "She imitates every gesture of her teacher."+test "We imitated the cadence from the recording." "We imitated the cadence of the recording."+test "He imitates the haircut from the cover model." "He imitates the haircut of the cover model."+test "They are imitating the protocol from their architects." "They are imitating the protocol of their architects."+test "The troupe imitates every flourish from the original cast." "The troupe imitates every flourish of the original cast."+test "Our design imitates the polish from Picasso's gouache." "Our design imitates the polish of Picasso's gouache."+test "The coach imitates the pace from the champion." "The coach imitates the pace of the champion."+test "I imitated the approach from the guide." "I imitated the approach of the guide."+test "We imitate the vibe from our favorite show." "We imitate the vibe of our favorite show."+test "She imitates that electric rhythm from the rehearsal tape." "She imitates that electric rhythm of the rehearsal tape."+test "They imitate him from the clip to get the cadence right." "They imitate him of the clip to get the cadence right."++# Guardrails / False positives+allows "They imitate from memory."+allows "He imitates from scratch."+allows "The mimic imitates from afar."+allows "Imitate from this formula only when you intend to copy exact numbers."+allows "Our dancer imitates from the safety of the balcony."+allows "She imitates from the stage instead of the audience."diff --git a/harper-core/src/linting/weir_rules/ItsContraction.weir b/harper-core/src/linting/weir_rules/ItsContraction.weirnew file mode 100644index 000000000..fd2eddc84--- /dev/null+++ b/harper-core/src/linting/weir_rules/ItsContraction.weir@@ -0,0 +1,29 @@+expr main <(its [anybody, anyone, anything, anywhere, everybody, everyone, everything, everywhere, somebody, someone, something, somewhere, nobody, nothing, nowhere]), (its)>++let message "When `its` introduces an idea such as `anything`, `someone`, or `nowhere`, reach for the contraction `it's` instead."+let description "The possessive `its` is often mistaken for `it's` when it is followed by vague pronouns (any-, every-, some-, or no- + body/one/thing/where)."+let kind "Grammar"+let becomes "it's"+let strategy "MatchCase"++# True positives+test "Its anybody who volunteers should speak up." "It's anybody who volunteers should speak up."+test "Its anyone you ping will be looped in automatically." "It's anyone you ping will be looped in automatically."+test "Its everyone on the thread noticed the spike." "It's everyone on the thread noticed the spike."+test "Its everything we collect ends up in the archive." "It's everything we collect ends up in the archive."+test "Its somebody on call right now." "It's somebody on call right now."+test "Its somewhere safe to stash the nightly dump." "It's somewhere safe to stash the nightly dump."+test "Its nobody left who can approve this." "It's nobody left who can approve this."+test "Its anywhere the monitors blink red." "It's anywhere the monitors blink red."+test "Its anything worth keeping should be archived." "It's anything worth keeping should be archived."+test "Its something that keeps restarting the job." "It's something that keeps restarting the job."++# False negatives (current limitation: `its` + negative modifiers such as "not" or "never" are not covered yet)+allows "Its not anybody to blame despite the outage."+allows "Its never anywhere near the ideal timing we hoped for."++# Guardrails / False positives+test "Its tail twitches every time I call it." "Its tail twitches every time I call it."+test "Its release pipeline is stable in production." "Its release pipeline is stable in production."+test "The cluster updates its nodes nightly." "The cluster updates its nodes nightly."+test "Its cover page mentions all contributors." "Its cover page mentions all contributors."diff --git a/harper-core/src/linting/weir_rules/KindSortOf.weir b/harper-core/src/linting/weir_rules/KindSortOf.weirnew file mode 100644index 000000000..224b8f56b--- /dev/null+++ b/harper-core/src/linting/weir_rules/KindSortOf.weir@@ -0,0 +1,35 @@+expr connector [kind, sort]+expr wrongprep [if, off]+expr guard ![PRON, INTJ, PART, CCONJ, SCONJ, ADP, PUNCT, this, that, these, those, there, here]++expr main <((@connector @wrongprep) @guard), (@wrongprep)>++let message "Use `of` after `kind` or `sort` when you mean the softening filler instead of the typo."+let description "Flags `kind if` or `sort off` that stand before qualifiers so the filler `of` stays intact."+let kind "Typo"+let becomes "of"++# True positives++test "I'm kind if tired today." "I'm kind of tired today."+test "Sort off the new theme looked strange." "Sort of the new theme looked strange."+test "This is kind if a stretch for sure." "This is kind of a stretch for sure."+test "We saw sort off the same glitch twice." "We saw sort of the same glitch twice."+test "Kind off serious bugs remain." "Kind of serious bugs remain."+test "Sort off a few people ignored the warning." "Sort of a few people ignored the warning."+test "KIND IF IMPORTANT signals lit up the board." "KIND OF IMPORTANT signals lit up the board."+test "kind off perfectly tuned feedback arrived." "kind of perfectly tuned feedback arrived."+test "Sort off a steady trend emerges soon." "Sort of a steady trend emerges soon."++# True negatives / false positives++test "Be kind if you can." "Be kind if you can."+test "Sort if that path seems safe." "Sort if that path seems safe."+test "Kind if there is time, I'll help." "Kind if there is time, I'll help."+test "Sort if this plan feels solid." "Sort if this plan feels solid."++# Known false negatives++test "Kind if, at first, the logs were quiet." "Kind if, at first, the logs were quiet."+test "Sort off, despite the caveats, the data feels solid." "Sort off, despite the caveats, the data feels solid."+test "kind if whatever, I trust the fix." "kind if whatever, I trust the fix."diff --git a/harper-core/src/linting/weir_rules/LikelyHood.weir b/harper-core/src/linting/weir_rules/LikelyHood.weirnew file mode 100644index 000000000..79b0ac2de--- /dev/null+++ b/harper-core/src/linting/weir_rules/LikelyHood.weir@@ -0,0 +1,26 @@+expr main (likely hood)++let message "Merge `likely hood` into the established noun `likelihood`."+let description "Treat the split tokens as one compound word (`likelihood`) whenever the adjective `likely` precedes `hood`."+let kind "Usage"+let becomes "likelihood"+let strategy "MatchCase"++# True positives+test "likely hood" "likelihood"+test "Likely hood" "Likelihood"+test "The likely hood of rain has me packing an umbrella." "The likelihood of rain has me packing an umbrella."+test "We treat that likely hood as a probability metric." "We treat that likelihood as a probability metric."+test "An analyst improved on his likely hood forecast." "An analyst improved on his likelihood forecast."+test "The likely hood of data loss grows with age." "The likelihood of data loss grows with age."+test "Another likely hood sample shows the same pattern." "Another likelihood sample shows the same pattern."+test "My likely hood estimation improved yesterday." "My likelihood estimation improved yesterday."+test "Likely hood matters more than a coin flip." "Likelihood matters more than a coin flip."+test "Treat that likely hood carefully." "Treat that likelihood carefully."++# Seek to leave everything else untouched+allows "The hood is dark and damp."+allows "I like your hooded jacket; it's warm."+allows "Likely, the hood is black tonight."+allows "The likelihood is already high so we celebrate."+allows "He feared the hoods in the alley."diff --git a/harper-core/src/linting/weir_rules/MercedesBenzHyphen.weir b/harper-core/src/linting/weir_rules/MercedesBenzHyphen.weirnew file mode 100644index 000000000..0328aa26d--- /dev/null+++ b/harper-core/src/linting/weir_rules/MercedesBenzHyphen.weir@@ -0,0 +1,28 @@+expr main (Mercedes Benz)++let message "Hyphenate the two components of this classic Mercedes-Benz trademark."+let description "Connect the separate words `Mercedes` and `Benz` whenever they appear together so the brand stays consistent with its official styling."+let kind "Spelling"+let becomes "Mercedes-Benz"+let strategy "Exact"++# True positives+test "Mercedes Benz is iconic." "Mercedes-Benz is iconic."+test "Have you seen Mercedes Benz commercials?" "Have you seen Mercedes-Benz commercials?"+test "I booked a Mercedes Benz for the demo." "I booked a Mercedes-Benz for the demo."+test "mercedes benz is fast." "Mercedes-Benz is fast."+test "MERCEDES BENZ leads the standings." "Mercedes-Benz leads the standings."+test "My neighbor bought a Mercedes Benz." "My neighbor bought a Mercedes-Benz."+test "The Mercedes Benz, as a brand, makes waves." "The Mercedes-Benz, as a brand, makes waves."+test "Mercedes Benz should never be split." "Mercedes-Benz should never be split."+test "Mercedes Benz and BMW kept things exciting." "Mercedes-Benz and BMW kept things exciting."+test "The factory's Mercedes Benz fleet grows." "The factory's Mercedes-Benz fleet grows."+test "Mercedes Benz will celebrate 100 years next year." "Mercedes-Benz will celebrate 100 years next year."+test "Testing shows Mercedes Benz is still relevant." "Testing shows Mercedes-Benz is still relevant."++# False positives / true negatives+allows "Mercedes-Benz is in the race."+allows "I drove a Benz and a Mercedes the same day."++# False negatives (current limitation: possessive suffix)+allows "Mercedes Benz's heritage is storied."diff --git a/harper-core/src/linting/weir_rules/NobelPeacePrize.weir b/harper-core/src/linting/weir_rules/NobelPeacePrize.weirnew file mode 100644index 000000000..6e0bf5e55--- /dev/null+++ b/harper-core/src/linting/weir_rules/NobelPeacePrize.weir@@ -0,0 +1,29 @@+expr main [(noble [peace, piece] [price, prize, prise]), (nobel piece [price, prize, prise]), (nobel peace price), (nobel peace prise)]++let message "Spell the name of the international peace award as Nobel Peace Prize."+let description "Corrects the frequent typos that swap the Nobel/Peace/Prize spelling when people mention the prize."+let kind "Typo"+let becomes "Nobel Peace Prize"+let strategy "Exact"+# True positives+test "He accepted the Noble Peace Price at the ceremony." "He accepted the Nobel Peace Prize at the ceremony."+test "Our timeline mentions the Noble peace price until 1950." "Our timeline mentions the Nobel Peace Prize until 1950."+test "noble peace price facts are easy to recap." "Nobel Peace Prize facts are easy to recap."+test "Nobel piece price committees meet tonight." "Nobel Peace Prize committees meet tonight."+test "nobel piece prize winners shared stories." "Nobel Peace Prize winners shared stories."+test "Nobel piece prise ceremonies look ready." "Nobel Peace Prize ceremonies look ready."+test "NOBLE PIECE PRICE stands out in the article." "Nobel Peace Prize stands out in the article."+test "She referenced the noble piece price memo." "She referenced the Nobel Peace Prize memo."+test "Noble Peace Prise references appear frequently." "Nobel Peace Prize references appear frequently."+test "nobel peace prise news alerted the team." "Nobel Peace Prize news alerted the team."+test "nobel piece price reports track the conference." "Nobel Peace Prize reports track the conference."+test "The noble piece prise historian wrote a book." "The Nobel Peace Prize historian wrote a book."++# True negatives / false positives+test "The Nobel Peace Prize ceremony is broadcast worldwide." "The Nobel Peace Prize ceremony is broadcast worldwide."+test "Nobel Prize for Peace winners remain inspiring." "Nobel Prize for Peace winners remain inspiring."+test "Peace Prize winners celebrate after the award." "Peace Prize winners celebrate after the award."++# Known false negatives+test "The Nobel Peace Prices for the exhibition confuse some visitors." "The Nobel Peace Prices for the exhibition confuse some visitors."+test "Stories mention the Noble Peace Prizes across years." "Stories mention the Noble Peace Prizes across years."diff --git a/harper-core/src/linting/weir_rules/NotBeAfterNot.weir b/harper-core/src/linting/weir_rules/NotBeAfterNot.weirnew file mode 100644index 000000000..eba88499c--- /dev/null+++ b/harper-core/src/linting/weir_rules/NotBeAfterNot.weir@@ -0,0 +1,33 @@+expr beforms [am, is, are, was, were, be, been, being, I'm, you're, we're, they're, he's, she's, it's]+expr complements [ADJ, ADP, ADV, DET, NOUN, NUM, PRON, PROPN, VERB, VBN, VBG]++expr main <(@beforms not be @complements), (not be)>++let message "When a negative clause already uses `be`, drop the extra `be` that follows `not`."+let description "Removes the redundant linking verb that sneaks in between `not` and the predicate after a conjugated `be`."+let kind "Grammar"+let becomes "not"++# True positives+test "I am not be happy today." "I am not happy today."+test "They are not be ready for the call." "They are not ready for the call."+test "We were not be asked anything." "We were not asked anything."+test "She is not be aware of the change." "She is not aware of the change."+test "I am not be a doctor yet." "I am not a doctor yet."+test "I'm not be prepared for that kind of question." "I'm not prepared for that kind of question."+test "He was not be allowed to speak last night." "He was not allowed to speak last night."+test "If you are not be careful, the paint will drip." "If you are not careful, the paint will drip."+test "The group was not be thinking about that possibility." "The group was not thinking about that possibility."+test "I am not be in the mood today." "I am not in the mood today."+test "They were not be sure yet." "They were not sure yet."+test "He is not be already there." "He is not already there."+test "You are not be of much help today." "You are not of much help today."+test "The team were not be attending the show." "The team were not attending the show."+test "I am not be comfortable sharing that yet." "I am not comfortable sharing that yet."++# True negatives / false-positive guards+allows "They will not be ready for the call."+allows "I am not being difficult with you."+allows "We are not the group who can finish this."+allows "She was not a fan of the show."+allows "I'm not sure if that will work."diff --git a/harper-core/src/linting/weir_rules/OnFirstGlance.weir b/harper-core/src/linting/weir_rules/OnFirstGlance.weirnew file mode 100644index 000000000..1f35783cc--- /dev/null+++ b/harper-core/src/linting/weir_rules/OnFirstGlance.weir@@ -0,0 +1,31 @@+expr main <([(on first glance), (on a first glance), (on the first glance)]), ([on])>++let message "Use `at first glance` instead of `on first glance` when describing an immediate impression."+let description "The standard idiom starts with `at` for quick appraisals, so swap the preposition to keep the phrase idiomatic."+let kind "Usage"+let becomes "at"+let strategy "MatchCase"++# True positives++test "On first glance it seems like a good plan." "At first glance it seems like a good plan."+test "On first glance, the homepage felt fast." "At first glance, the homepage felt fast."+test "On a first glance the credential list looked complete." "At a first glance the credential list looked complete."+test "On the first glance I took at the draft, the tone felt steady." "At the first glance I took at the draft, the tone felt steady."+test "ON FIRST GLANCE the tab looked empty." "AT FIRST GLANCE the tab looked empty."+test "On first glance we thought the fix had landed." "At first glance we thought the fix had landed."++# False negatives (should also trigger)++test "On first glance? the fix seemed ready." "At first glance? the fix seemed ready."+test "On a first glance when scanning the changelog, there were no errors." "At a first glance when scanning the changelog, there were no errors."+test "On the first glance at the dashboard nothing seemed off." "At the first glance at the dashboard nothing seemed off."+test "On first glance--before the audit--the facade looked clean." "At first glance--before the audit--the facade looked clean."++# Guardrails / false positives / true negatives++test "At first glance the patch was a keeper." "At first glance the patch was a keeper."+test "My first glance at the console logs offered little insight." "My first glance at the console logs offered little insight."+test "First glance data points still need verification." "First glance data points still need verification."+test "The timeline on the first slide looked accurate." "The timeline on the first slide looked accurate."+test "He always writes `on first` as part of a headline." "He always writes `on first` as part of a headline."diff --git a/harper-core/src/linting/weir_rules/OneHanded.weir b/harper-core/src/linting/weir_rules/OneHanded.weirnew file mode 100644index 000000000..a8917c761--- /dev/null+++ b/harper-core/src/linting/weir_rules/OneHanded.weir@@ -0,0 +1,31 @@+expr main <([one, two] handed ![DET, PRON, ADP, PUNCT]), ([one, two] handed)>++let message "Keep the numeral and 'handed' joined as a hyphenated modifier when they describe a noun."+let description "Treat 'one handed' and 'two handed' as single adjectives before nouns so the measurement stays attached to 'handed'."+let kind "Punctuation"+let becomes ["one-handed", "two-handed"]+let strategy "MatchCase"++# True positives+# The hyphenated form is preferred whenever the compound modifies a noun.+test "A one handed catch can seal the win." "A one-handed catch can seal the win."+test "We built two handed handles for the door." "We built two-handed handles for the door."+test "The mechanic admired that one handed tool." "The mechanic admired that one-handed tool."+test "Two handed swords need extra clearance." "Two-handed swords need extra clearance."+test "one handed work is still performed by skilled climbers." "one-handed work is still performed by skilled climbers."+test "Our Two Handed lift completed the load." "Our Two-Handed lift completed the load."+test "Two handed heavy lifts stress the crew." "Two-handed heavy lifts stress the crew."+test "Her one handed strike knocked them down." "Her one-handed strike knocked them down."+test "The two handed mammal puppet looked real." "The two-handed mammal puppet looked real."+test "ONE HANDED MOVES LOOK ELEGANT ON STAGE." "ONE-HANDED MOVES LOOK ELEGANT ON STAGE."+test "The two handed steel brace kept flex to a minimum." "The two-handed steel brace kept flex to a minimum."+test "Our two handed design earned praise from the panel." "Our two-handed design earned praise from the panel."+test "a one handed grip is required for that maneuver." "a one-handed grip is required for that maneuver."++# True negatives / false positives+# These scenarios treat 'handed' as a verb or object, so they should stay untouched.+test "No one handed them anything." "No one handed them anything."+test "One handed me a basket and left." "One handed me a basket and left."+test "All but one handed in their notices." "All but one handed in their notices."+test "One handed the baton to his mate." "One handed the baton to his mate."+test "Two handed the paperwork to the new hire." "Two handed the paperwork to the new hire."diff --git a/harper-core/src/linting/weir_rules/ShutdownVerb.weir b/harper-core/src/linting/weir_rules/ShutdownVerb.weirnew file mode 100644index 000000000..3b1e35042--- /dev/null+++ b/harper-core/src/linting/weir_rules/ShutdownVerb.weir@@ -0,0 +1,29 @@+expr helper [AUX, will, would, should, could, can, may, might, must, has, have, had, is, are, was, were, am, do, does, did]+expr subject [PRON, PROPN, NOUN]+expr main <([( @helper shutdown), (@helper @subject shutdown), (@helper not shutdown), (@helper @subject not shutdown), (@helper not @subject shutdown)]), shutdown>++let message "Use the verbal phrase `shut down` whenever an auxiliary verb is pulling `shutdown` into a predicate."+let description "Keeps `shutdown` as a noun when it stands alone but swaps it for the phrasal verb `shut down` whenever an auxiliary precedes it."+let kind "Grammar"+let becomes "shut down"++# True positives+# These are scenarios where `shutdown` is acting like the verb, so the rule should rehydrate it into two words.+test "I will shutdown the server after work." "I will shut down the server after work."+test "You can shutdown the old cluster tonight." "You can shut down the old cluster tonight."+test "He has shutdown the backup process already." "He has shut down the backup process already."+test "They have not shutdown the service yet." "They have not shut down the service yet."+test "Should we shutdown the build manually?" "Should we shut down the build manually?"+test "Would John shutdown the demo if we ask?" "Would John shut down the demo if we ask?"+test "Could you not shutdown the database until backups finish?" "Could you not shut down the database until backups finish?"+test "She won't shutdown the fleet until the engineers arrive." "She won't shut down the fleet until the engineers arrive."+test "Can Alice shutdown this branch for me?" "Can Alice shut down this branch for me?"+test "I shouldn't shutdown the node without warning." "I shouldn't shut down the node without warning."+test "Has he shutdown the node yet?" "Has he shut down the node yet?"++# True negatives (these should remain untouched)+test "The shutdown lasted ten minutes." "The shutdown lasted ten minutes."+test "Our planned shutdown is scheduled for Friday." "Our planned shutdown is scheduled for Friday."+test "They shut down the network yesterday." "They shut down the network yesterday."+test "Shutdown procedures are in the handbook." "Shutdown procedures are in the handbook."+test "A forced shutdown is rare in this cluster." "A forced shutdown is rare in this cluster."diff --git a/harper-core/src/linting/weir_rules/SimilarLike.weir b/harper-core/src/linting/weir_rules/SimilarLike.weirnew file mode 100644index 000000000..170d3ae88--- /dev/null+++ b/harper-core/src/linting/weir_rules/SimilarLike.weir@@ -0,0 +1,26 @@+expr main similar like++let message "Prefer 'similar to' instead of 'similar like'."+let description "The adjective 'similar' pairs with the preposition 'to', so never follow it with 'like'."+let kind "Usage"+let becomes "similar to"+let strategy "MatchCase"++# True positives+test "similar like" "similar to"+test "Similar like" "Similar to"+test "SIMILAR LIKE" "SIMILAR TO"+test "My idea is similar like yours." "My idea is similar to yours."+test "We noticed similar like behavior in each release." "We noticed similar to behavior in each release."+test "Tell me if this sample feels similar like the old version." "Tell me if this sample feels similar to the old version."+test "The proof seemed similar like every previous argument." "The proof seemed similar to every previous argument."+test "A similar like token often flags the wrong preposition." "A similar to token often flags the wrong preposition."++# True negatives / guardrails+test "The two items are similar too." "The two items are similar too."+test "She is similar in taste." "She is similar in taste."+test "similar to" "similar to"+test "This word similarlike is unusual." "This word similarlike is unusual."+test "His similar likeness is uncanny." "His similar likeness is uncanny."+test "I enjoy similar lighting at dusk." "I enjoy similar lighting at dusk."+test "She mentioned similar limitations yesterday." "She mentioned similar limitations yesterday."diff --git a/harper-core/src/linting/weir_rules/SpinalChord.weir b/harper-core/src/linting/weir_rules/SpinalChord.weirnew file mode 100644index 000000000..044166741--- /dev/null+++ b/harper-core/src/linting/weir_rules/SpinalChord.weir@@ -0,0 +1,34 @@+expr main <([(spinal [chord, chords]), (vocal [chord, chords]), (umbilical [chord, chords]), (electrical [chord, chords])]), ([chord, chords])>++let message "Drop the `h` after these anatomical or wiring descriptors; the structure is a `cord`."+let description "The words `spinal`, `vocal`, `umbilical`, and `electrical` are followed by `cord`, so replace accidental `chord`/`chords`."+let kind "Typo"+let becomes ["cord", "cords"]+let strategy "MatchCase"++# True positives++test "The patient injured the spinal chord this week." "The patient injured the spinal cord this week."+test "Musicians talked about the vocal chord vibrations." "Musicians talked about the vocal cord vibrations."+test "Doctors monitor the umbilical chord after delivery." "Doctors monitor the umbilical cord after delivery."+test "Electrical chord damage can start a fire." "Electrical cord damage can start a fire."+test "We studied the spinal chords in anatomy class." "We studied the spinal cords in anatomy class."+test "The singer's vocal chords were sore." "The singer's vocal cords were sore."+test "Umbilical chords should remain intact until clamping." "Umbilical cords should remain intact until clamping."+test "Electrical chords spark when overloaded." "Electrical cords spark when overloaded."+test "Spinal chord repair takes steady hands." "Spinal cord repair takes steady hands."+test "Vocal chord therapy helped the speaker." "Vocal cord therapy helped the speaker."+test "Umbilical chord issues raised concern." "Umbilical cord issues raised concern."+test "The crew replaced the electrical chords on stage." "The crew replaced the electrical cords on stage."+test "Spinal chords often accompany nerve damage." "Spinal cords often accompany nerve damage."+test "Vocal chords sustain the melody." "Vocal cords sustain the melody."+test "Electrical chords run along the wall." "Electrical cords run along the wall."++# False positives / true negatives++allows "A guitar chord can sound beautiful."+allows "The lamp cord is frayed but still works."+allows "Spinal cord injuries require care."+allows "Vocal cords vibrate when we sing."+allows "Umbilical cord clamping is a delicate step."+allows "Remember to unplug the electrical cord before repairs."diff --git a/harper-core/src/linting/weir_rules/StrikeChord.weir b/harper-core/src/linting/weir_rules/StrikeChord.weirnew file mode 100644index 000000000..2a53b2700--- /dev/null+++ b/harper-core/src/linting/weir_rules/StrikeChord.weir@@ -0,0 +1,31 @@+expr main (strike a cord)++let message "Use the idiom with `chord` when describing a feeling or reaction."+let description "The phrase about resonating with someone is spelled with a chord, not a cord, so fix the typo and keep the idiom intact."+let kind "Typo"+let becomes "strike a chord"+let strategy "MatchCase"++# True positives+test "A heartfelt verse might strike a cord in every reader." "A heartfelt verse might strike a chord in every reader."+test "He tried to strike a cord during the keynote." "He tried to strike a chord during the keynote."+test "This rally plan is designed to strike a cord with voters." "This rally plan is designed to strike a chord with voters."+test "Will this line strike a cord, or will it fall flat?" "Will this line strike a chord, or will it fall flat?"+test "Our new video is meant to strike a cord across cultures." "Our new video is meant to strike a chord across cultures."+test "When they strike a cord, the crowd remembers the old anthem." "When they strike a chord, the crowd remembers the old anthem."+test "Strike a cord with humor and you win the room." "Strike a chord with humor and you win the room."+test "STRIKE A CORD BEFORE THE DROP." "STRIKE A CHORD BEFORE THE DROP."+test "It might strike a cord, then fade." "It might strike a chord, then fade."+test "Strike a cord - just not the one you are thinking of." "Strike a chord - just not the one you are thinking of."++# False negatives (these contexts should also resolve to the idiom)+test "We plan to strike a cord; the sentiment should spread." "We plan to strike a chord; the sentiment should spread."+test "The song will strike a cord? We'll see." "The song will strike a chord? We'll see."+test "Do not wait until the chorus to strike a cord." "Do not wait until the chorus to strike a chord."+test "I hope we strike a cord tomorrow." "I hope we strike a chord tomorrow."+test "As soon as they strike a cord, the thread goes viral." "As soon as they strike a chord, the thread goes viral."++# False positives / true negatives+allows "I want to strike a chord tonight."+allows "He plugged the cord into the amp before playing."+allows "The guitar teacher told him to strike the chord on beat."diff --git a/harper-core/src/linting/weir_rules/TheyToThem.weir b/harper-core/src/linting/weir_rules/TheyToThem.weirnew file mode 100644index 000000000..2edd73a85--- /dev/null+++ b/harper-core/src/linting/weir_rules/TheyToThem.weir@@ -0,0 +1,34 @@+expr main <([to, with, for, about, against, between, among, around, toward, towards, through, beyond, behind, across, near, inside, outside, call, contact, invite, remind, ask, see, watch, help, trust, send, support, follow, visit, tell, thank, mention, show] they), they>++let message "Use `them` when the pronoun follows a preposition or transitive verb."+let description "Converts `they` to `them` whenever the pronoun serves as an object after common prepositions or actions that take direct objects."+let kind "Grammar"+let becomes "them"+let strategy "MatchCase"++# True positives++test "Talk to they about the plan." "Talk to them about the plan."+test "I will ask they for consent." "I will ask them for consent."+test "Send they the invitation." "Send them the invitation."+test "Call they when you arrive." "Call them when you arrive."+test "Contact they via email." "Contact them via email."+test "Thank they for their help." "Thank them for their help."+test "I remind they as soon as possible." "I remind them as soon as possible."+test "Discuss with they the new requirements." "Discuss with them the new requirements."+test "We fought against they for fairness." "We fought against them for fairness."+test "Between they and us, the message is clear." "Between them and us, the message is clear."+test "Tell they the good news." "Tell them the good news."+test "CALL THEY TODAY." "CALL THEM TODAY."+test "Support they during the transition." "Support them during the transition."+test "Show they how the tool works." "Show them how the tool works."++test "Mention they in your update." "Mention them in your update."++# True negatives++test "They went to the store." "They went to the store."+test "I know they will arrive soon." "I know they will arrive soon."+test "Because they are busy, we rescheduled." "Because they are busy, we rescheduled."+test "They told us they would stay." "They told us they would stay."+test "They announced the event yesterday." "They announced the event yesterday."diff --git a/harper-core/src/linting/weir_rules/ThreatenVerb.weir b/harper-core/src/linting/weir_rules/ThreatenVerb.weirnew file mode 100644index 000000000..a59097ef6--- /dev/null+++ b/harper-core/src/linting/weir_rules/ThreatenVerb.weir@@ -0,0 +1,34 @@+expr modalAux [will, would, should, could, can, may, might, must, shall, won't, wouldn't, shouldn't, couldn't, can't, mustn't]++expr subject [(DET NOUN), (DET PROPN), PRON, NOUN, PROPN]+expr main <([( @modalAux threat), (@modalAux @subject threat)]), threat>++let message "Modal verbs followed by `threat` almost always intend the verb `threaten`."+let description "Normalize `threat` to `threaten` when it is used after modals (or their contractions) because the noun form is being mistaken for a verb."+let kind "Grammar"+let becomes "threaten"+let strategy "MatchCase"++test "I will threat the vendor if they miss another check-in." "I will threaten the vendor if they miss another check-in."+test "You shouldn't threat the partnership over a misunderstanding." "You shouldn't threaten the partnership over a misunderstanding."+test "We could threat the release if the bug persists." "We could threaten the release if the bug persists."+test "They might threat the roadmap during the review." "They might threaten the roadmap during the review."+test "You must threat the issue before it escalates." "You must threaten the issue before it escalates."+test "He should threat his backup plan." "He should threaten his backup plan."+test "We wouldn't threat our customers for honest feedback." "We wouldn't threaten our customers for honest feedback."+test "She can't threat the crew without checking policy." "She can't threaten the crew without checking policy."+test "I would threat the system again if it keeps failing." "I would threaten the system again if it keeps failing."+test "May I threat them later?" "May I threaten them later?"+test "Might you threat the schedule to force a fix?" "Might you threaten the schedule to force a fix?"+test "You won't threat me with the same ultimatum twice." "You won't threaten me with the same ultimatum twice."+test "Should they threat the platform to pressure the release?" "Should they threaten the platform to pressure the release?"+test "I WILL threat the contract if the clauses keep changing." "I WILL threaten the contract if the clauses keep changing."+test "They mustn't threat the new hires." "They mustn't threaten the new hires."++allows "The threat on the board made everyone nervous."+allows "This threat level matches last winter's storms."+allows "Threat modeling exercises take several days."+allows "Treat each threat seriously, but don't confuse the noun with the verb."+allows "A threat scenario looks at possible attackers and motives."+allows "Her tone sounded like the threat of a storm, not a promise."+allows "Threat actors often test the defenses before committing to a breach."diff --git a/harper-core/src/linting/weir_rules/ToBackOut.weir b/harper-core/src/linting/weir_rules/ToBackOut.weirnew file mode 100644index 000000000..7e640f31c--- /dev/null+++ b/harper-core/src/linting/weir_rules/ToBackOut.weir@@ -0,0 +1,30 @@+expr main (to backout)++let message "Separate `backout` into the verb `back out` after `to`."+let description "Treats `to backout` as a mistyped infinitive and prefers the two-word verb."+let kind "Usage"+let becomes "to back out"++# True positives+test "There's still time to backout of the deal." "There's still time to back out of the deal."+test "Make sure to backout that commit before merging." "Make sure to back out that commit before merging."+test "I told them to BACKOUT once the bug surfaced." "I told them to BACK OUT once the bug surfaced."+test "Please remember to backout the change if it breaks tests." "Please remember to back out the change if it breaks tests."+test "To backout, you can cancel the pipeline." "To back out, you can cancel the pipeline."+test "We still might need to backout this feature." "We still might need to back out this feature."+test "If we have to TO BACKOUT now, we should warn everyone." "If we have to TO BACK OUT now, we should warn everyone."+test "We might need to backout; let us know." "We might need to back out; let us know."++# False negative coverage (punctuation and casing should still trigger).+test "to backout?" "to back out?"+test "to backout!" "to back out!"++# True negatives (these contexts should stay untouched).+test "We plan to back out after the meeting." "We plan to back out after the meeting."+test "The backout plan came with the release." "The backout plan came with the release."+test "Backout is spelled as a noun in this paragraph." "Backout is spelled as a noun in this paragraph."+test "to back out" "to back out"++# False positives (near misses that should not change).+test "This doc mentions to backouts and other options." "This doc mentions to backouts and other options."+test "They call it the backout-ary clause." "They call it the backout-ary clause."diff --git a/harper-core/src/linting/weir_rules/TuffEnough.weir b/harper-core/src/linting/weir_rules/TuffEnough.weirnew file mode 100644index 000000000..35f2f5c1e--- /dev/null+++ b/harper-core/src/linting/weir_rules/TuffEnough.weir@@ -0,0 +1,31 @@+expr main <(tuff [enough, like]), (tuff)>++let message "Swap `tuff` for `tough` when it describes strength or difficulty followed by 'enough' or 'like'."+let description "The adjective `tough` pairs with words like `enough` or `like`, so correct the common typo `tuff` in those constructions."+let kind "Typo"+let becomes "tough"+let strategy "MatchCase"++# True positives+# These examples should be rewritten with 'tough'.+test "He was tuff enough to lift it." "He was tough enough to lift it."+test "That plan needs to be tuff enough to withstand critique." "That plan needs to be tough enough to withstand critique."+test "Tuff enough, he still tried." "Tough enough, he still tried."+test "I'm feeling tuff like a warrior today." "I'm feeling tough like a warrior today."+test "Her tuff enough answer silenced the crowd." "Her tough enough answer silenced the crowd."+test "The tuff like textures on the armor impressed me." "The tough like textures on the armor impressed me."+test "They need to be tuff enough to finish the run." "They need to be tough enough to finish the run."+test "Tuff like this builds character." "Tough like this builds character."+test "She acted tuff enough to merge the teams." "She acted tough enough to merge the teams."+test "Tuff like steel, the hinge kept swinging." "Tough like steel, the hinge kept swinging."+test "The argument must be tuff enough to sway them." "The argument must be tough enough to sway them."+test "Tuff enough socks keep the feet warm." "Tough enough socks keep the feet warm."++# True negatives+# The rule should not fire when `tuff` is part of a name or followed by other words.+test "Tuff City hosts the festival." "Tuff City hosts the festival."+test "He called the passage tuff and unforgiving." "He called the passage tuff and unforgiving."+test "She grabbed a tuff bar before the workout." "She grabbed a tuff bar before the workout."++allows "Stay tuff, friend."+allows "Tuff, the nickname, belonged to his grandfather."diff --git a/harper-core/src/linting/weir_rules/VeryKnown.weir b/harper-core/src/linting/weir_rules/VeryKnown.weirnew file mode 100644index 000000000..5cd4b6ef8--- /dev/null+++ b/harper-core/src/linting/weir_rules/VeryKnown.weir@@ -0,0 +1,30 @@+expr main (very known)++let message "Replace `very known` with the idiomatic phrasing that mentions recognition explicitly."+let description "`very well-known` (or `well-known`) is the standard way to describe something widely recognized, so we flag the uncommon `very known` word pair."+let kind "Usage"+let becomes ["very well-known", "well-known"]+let strategy "MatchCase"++test "He is a very known actor." "He is a very well-known actor."+test "Her work is very known among the local schools." "Her work is very well-known among the local schools."+test "Our very known product draws new users every month." "Our very well-known product draws new users every month."+test "The very known landmark draws visitors all year." "The very well-known landmark draws visitors all year."+test "Very known memes cycle through the forum quickly." "Very well-known memes cycle through the forum quickly."+test "I saw a very known engineer presenting at yesterday's event." "I saw a very well-known engineer presenting at yesterday's event."+test "This very known rumor sparked debate on social feeds." "This very well-known rumor sparked debate on social feeds."+test "They keep very known influencers on the payroll." "They keep very well-known influencers on the payroll."+test "Is that a very known bug in this app?" "Is that a very well-known bug in this app?"+test "It's a very known trick in debugging." "It's a very well-known trick in debugging."+test "Very known incidents are still in the news." "Very well-known incidents are still in the news."+test "A very known glitch pops up when we run the suite." "A very well-known glitch pops up when we run the suite."+test "The very known singer clicked with fans again." "The very well-known singer clicked with fans again."+test "We handle very known customers personally." "We handle very well-known customers personally."+test "Any very known shortcut is documented." "Any very well-known shortcut is documented."++allows "It is known very well, so we can move on."+allows "The very knowledge that matters is intangible."+allows "The very-known cover art is a nice throwback."+allows "The team is very knowledgeable about the API."+allows "They are extremely known for their tone."+allows "Known very well, the trick still surprises people."diff --git a/harper-core/src/linting/weir_rules/YourPredicateAdjective.weir b/harper-core/src/linting/weir_rules/YourPredicateAdjective.weirnew file mode 100644index 000000000..232975a62--- /dev/null+++ b/harper-core/src/linting/weir_rules/YourPredicateAdjective.weir@@ -0,0 +1,30 @@+expr main [<([your, yr, ur, ya] [cool, serious, ready, proud, patient, committed, calm, brave, excited, kind, delightful, awake, dedicated, loyal, (really patient), (very patient), (totally committed), (surprisingly calm), (exceptionally brave), (so excited), (very very kind), (absolutely delightful), (barely awake), (really dedicated)]), [your, yr, ur, ya]>]++let message "Use the contraction `you're` (you are) before predicate adjectives instead of the possessive `your` or its variants."+let description "Catches cases where a predicate adjective follows `your`, `yr`, `ur`, or `ya` and suggests the proper contraction so the sentence states how someone is feeling or behaving."+let kind "Grammar"+let becomes "you're"+let strategy "MatchCase"++test "Your cool." "You're cool."+test "your serious?" "you're serious?"+test "UR ready?" "YOU'RE ready?"+test "ya proud?" "you're proud?"+test "Your really patient." "You're really patient."+test "Your very patient." "You're very patient."+test "your totally committed?" "you're totally committed?"+test "UR surprisingly calm." "YOU'RE surprisingly calm."+test "Ya exceptionally brave?" "You're exceptionally brave?"+test "Your so excited?" "You're so excited?"+test "your very very kind." "you're very very kind."+test "YA absolutely delightful." "YOU'RE absolutely delightful."+test "ur barely awake." "you're barely awake."+test "Ya really dedicated." "You're really dedicated."+test "yr loyal?" "you're loyal?"++test "Your favorite color is blue." "Your favorite color is blue."+test "Your excitement is contagious." "Your excitement is contagious."+test "UR car is parked outside." "UR car is parked outside."+test "ya favorite flavor is mint." "ya favorite flavor is mint."+test "Your very good idea is interesting." "Your very good idea is interesting."+test "Ur new plan looks solid." "Ur new plan looks solid."diff --git a/harper-core/tests/text/linters/Alice's Adventures in Wonderland.snap.yml b/harper-core/tests/text/linters/Alice's Adventures in Wonderland.snap.ymlindex 2842caef9..fbf13fcd9 100644--- a/harper-core/tests/text/linters/Alice's Adventures in Wonderland.snap.yml+++ b/harper-core/tests/text/linters/Alice's Adventures in Wonderland.snap.yml@@ -3772,6 +3772,16 @@ Message: |+Lint: Grammar (31 priority)+Message: |+ 2741 | to see what the next witness would be like, “—for they haven’t got much evidence+ | ^~~~ Use `them` when the pronoun follows a preposition or transitive verb.+ 2742 | yet,” she said to herself. Imagine her surprise, when the White Rabbit read out,+Suggest:+ - Replace with: “them”+++Lint: Readability (127 priority)Message: |2747 | “Here!” cried Alice, quite forgetting in the flurry of the moment how large shediff --git a/harper-core/tests/text/linters/Difficult sentences.snap.yml b/harper-core/tests/text/linters/Difficult sentences.snap.ymlindex 7b8503edc..f85bc6adc 100644--- a/harper-core/tests/text/linters/Difficult sentences.snap.yml+++ b/harper-core/tests/text/linters/Difficult sentences.snap.yml@@ -363,3 +363,12 @@ Suggest:+Lint: Grammar (31 priority)+Message: |+ 464 | With your kind of body size, you shouldn’t be eating pizza at all.+ | ^~~~ Use the contraction `you're` (you are) before predicate adjectives instead of the possessive `your` or its variants.+Suggest:+ - Replace with: “you're”+++diff --git a/harper-core/tests/text/linters/The Great Gatsby.snap.yml b/harper-core/tests/text/linters/The Great Gatsby.snap.ymlindex 345c7054a..d633e2d0c 100644--- a/harper-core/tests/text/linters/The Great Gatsby.snap.yml+++ b/harper-core/tests/text/linters/The Great Gatsby.snap.yml@@ -4839,17 +4839,6 @@ Suggest:-Lint: Punctuation (54 priority)-Message: |- 3495 | It was when curiosity about Gatsby was at its highest that the lights in his- | ^~~ Use `it's` (short for `it has` or `it is`) here, not the possessive `its`.- 3496 | house failed to go on one Saturday night—and, as obscurely as it had begun, his-Suggest:- - Replace with: “it's”- - Replace with: “it has”---Lint: Spelling (63 priority)Message: |3496 | house failed to go on one Saturday night—and, as obscurely as it had begun, his