Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix: adverbs that can come before "quite" (#1972)
Andrew Dunbarec370d9b7f07
diff --git a/harper-core/src/linting/quite_quiet.rs b/harper-core/src/linting/quite_quiet.rsindex 9d7aad6d5..28966203d 100644--- a/harper-core/src/linting/quite_quiet.rs+++ b/harper-core/src/linting/quite_quiet.rs@@ -34,7 +34,10 @@ impl Default for QuiteQuiet {.t_aco("quiet");let adverb_quite = SequenceExpr::default()- .then_kind_except(TokenKind::is_adverb, &["never", "not"])+ .then_kind_except(+ TokenKind::is_adverb,+ &["actually", "never", "not", "really"],+ ).t_ws().t_aco("quite");@@ -57,7 +60,6 @@ impl ExprLinter for QuiteQuiet {let text = toks.span()?.get_content_string(src).to_lowercase();if text.ends_with("quite") {- let first_token = toks.first()?;let quite_span = toks.last()?.span;return Some(Lint {@@ -67,12 +69,10 @@ impl ExprLinter for QuiteQuiet {"quiet".chars().collect(),quite_span.get_content(src),)],- message: "After an adverb like '{}', use 'quiet' not 'quite'"- .replace("{}", &first_token.span.get_content_string(src)),+ message: "‘Quite’ might be a typo here. It means ‘rather’ but you might be trying to say ‘quiet’ (not noisy).".to_string(),priority: 63,});} else if text.starts_with("quiet") {- let last_token = toks.last()?;let quiet_span = toks.first()?.span;return Some(Lint {@@ -82,14 +82,10 @@ impl ExprLinter for QuiteQuiet {"quite".chars().collect(),quiet_span.get_content(src),)],- message: format!(- "Before an adjective, adverb, or verb like '{}', use 'quite' not 'quiet'",- last_token.span.get_content_string(src)- ),+ message: "‘Quiet’ might be a typo here. It means ‘not noisy’ but you might be trying to say ‘quite’ (rather).".to_string(),priority: 63,});} else if text.ends_with("quiet") {- let first_token = toks.first()?;let quiet_span = toks.last()?.span;return Some(Lint {@@ -99,8 +95,7 @@ impl ExprLinter for QuiteQuiet {"quite".chars().collect(),quiet_span.get_content(src),)],- message: "After a negative contraction like '{}', use 'quite' not 'quiet'"- .replace("{}", &first_token.span.get_content_string(src)),+ message: "‘Quiet’ might be a typo here. It means ‘not noisy’ but you might be trying to say ‘quite’ (rather).".to_string(),priority: 63,});}@@ -109,7 +104,7 @@ impl ExprLinter for QuiteQuiet {}fn description(&self) -> &str {- "Corrects when `quiet` is a typo for `quite` or the other way around."+ "Helps distinguish between ‘quiet’ (making ‘little noise’) and ‘quite’ (meaning ‘rather’)."}}@@ -209,4 +204,12 @@ mod tests {fn fix_but_its_not_quite_clear_1956() {assert_no_lints("But it's not quite clear", QuiteQuiet::default());}++ #[test]+ fn dont_flag_adv_quite_1971() {+ assert_no_lints(+ "It’s actually quite smart. It’s really quite smart. The proof is actually quite neat. Actually really quite simple. It’s actually quite strong. The Sneetches got really quite smart on that day.",+ QuiteQuiet::default(),+ );+ }}