Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix: 'a very' no longer flagged to change to 'Avery' (#1292)
Andrew Dunbar0eae3c997633
diff --git a/harper-core/src/linting/compound_nouns/implied_ownership_compound_nouns.rs b/harper-core/src/linting/compound_nouns/implied_ownership_compound_nouns.rsindex 707de606e..2a02a86d8 100644--- a/harper-core/src/linting/compound_nouns/implied_ownership_compound_nouns.rs+++ b/harper-core/src/linting/compound_nouns/implied_ownership_compound_nouns.rs@@ -45,12 +45,12 @@ impl PatternLinter for ImpliedOwnershipCompoundNouns {// "Let's" can technically be a possessive noun (of a lease, or a let in tennis, etc.)// but in practice it's almost always a contraction of "let us" before a verb// or a mistake for "lets", the 3rd person singular present form of "to let".- let word_apostrophe_s = matched_tokens[0].span.get_content(source);- if word_apostrophe_s- .iter()- .map(|&c| c.to_ascii_lowercase())- .eq(['l', 'e', 't', '\'', 's'].iter().copied())- {+ let word_apostrophe_s = matched_tokens[0]+ .span+ .get_content_string(source)+ .to_ascii_lowercase()+ .replace('’', "'");+ if word_apostrophe_s == "let's" || word_apostrophe_s == "that's" {return None;}let span = matched_tokens[2..].span()?;@@ -82,11 +82,29 @@ mod tests {use crate::linting::tests::assert_lint_count;#[test]- fn does_not_flag_lets() {+ fn lets_is_not_possessive() {assert_lint_count("Let's check out this article.",ImpliedOwnershipCompoundNouns::default(),0,);}++ #[test]+ fn lets_is_not_possessive_typographic_apostrophe() {+ assert_lint_count(+ "“Let’s go on with the game,” the Queen said to Alice;",+ ImpliedOwnershipCompoundNouns::default(),+ 0,+ )+ }++ #[test]+ fn thats_is_not_possessive() {+ assert_lint_count(+ "And you might not be thinking that that's a very big issue, but ...",+ ImpliedOwnershipCompoundNouns::default(),+ 0,+ );+ }}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 76aa4fe51..a766feb0e 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@@ -2202,15 +2202,6 @@ Suggest:-Lint: WordChoice (63 priority)-Message: |- 2061 | “Let’s go on with the game,” the Queen said to Alice; and Alice was too much- | ^~~~~ The possessive noun implies ownership of the closed compound noun “goon”.-Suggest:- - Replace with: “goon”---Lint: Readability (127 priority)Message: |2064 | The other guests had taken advantage of the Queen’s absence, and were resting indiff --git a/harper-core/tests/text/linters/The Great Gatsby.snap.yml b/harper-core/tests/text/linters/The Great Gatsby.snap.ymlindex 56d460241..8e3434809 100644--- a/harper-core/tests/text/linters/The Great Gatsby.snap.yml+++ b/harper-core/tests/text/linters/The Great Gatsby.snap.yml@@ -3395,15 +3395,6 @@ Suggest:-Lint: WordChoice (63 priority)-Message: |- 2212 | “Well!” I inspected them. “That’s a very interesting idea.”- | ^~~~~~ The possessive noun implies ownership of the closed compound noun “Avery”.-Suggest:- - Replace with: “Avery”---Lint: Spelling (63 priority)Message: |2218 | Mr. Wolfshiem drank his coffee with a jerk and got to his feet.@@ -5328,15 +5319,6 @@ Suggest:-Lint: WordChoice (63 priority)-Message: |- 4227 | “Daisy, that’s all over now,” he said earnestly. “It doesn’t matter any more.- | ^~~~~~~~ The possessive noun implies ownership of the closed compound noun “allover”.-Suggest:- - Replace with: “allover”---Lint: Spelling (63 priority)Message: |4241 | “Not at Kapiolani?” demanded Tom suddenly.