Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(core): remove the unhelpful `WrongQuotes` linter
Elijah Potter768b907076b9
diff --git a/harper-core/src/linting/lint_group.rs b/harper-core/src/linting/lint_group.rsindex 800b18bbd..2b60c6ca0 100644--- a/harper-core/src/linting/lint_group.rs+++ b/harper-core/src/linting/lint_group.rs@@ -65,7 +65,6 @@ use super::use_genitive::UseGenitive;use super::was_aloud::WasAloud;use super::whereas::Whereas;use super::wordpress_dotcom::WordPressDotcom;-use super::wrong_quotes::WrongQuotes;use super::{CurrencyPlacement, Linter, NoOxfordComma, OxfordComma};use super::{Lint, PatternLinter};use crate::linting::dashes::Dashes;@@ -319,7 +318,6 @@ impl LintGroup {insert_struct_rule!(AnA, true);insert_struct_rule!(SentenceCapitalization, true);insert_struct_rule!(UnclosedQuotes, true);- insert_struct_rule!(WrongQuotes, false);insert_struct_rule!(LongSentences, true);insert_struct_rule!(RepeatedWords, true);insert_struct_rule!(Spaces, true);diff --git a/harper-core/src/linting/mod.rs b/harper-core/src/linting/mod.rsindex 28bf87c71..d26aa20f5 100644--- a/harper-core/src/linting/mod.rs+++ b/harper-core/src/linting/mod.rs@@ -68,7 +68,6 @@ mod use_genitive;mod was_aloud;mod whereas;mod wordpress_dotcom;-mod wrong_quotes;pub use adjective_of_a::AdjectiveOfA;pub use an_a::AnA;@@ -132,7 +131,6 @@ pub use use_genitive::UseGenitive;pub use was_aloud::WasAloud;pub use whereas::Whereas;pub use wordpress_dotcom::WordPressDotcom;-pub use wrong_quotes::WrongQuotes;use crate::{Document, LSend};diff --git a/harper-core/src/linting/wrong_quotes.rs b/harper-core/src/linting/wrong_quotes.rsdeleted file mode 100644index b18878c8e..000000000--- a/harper-core/src/linting/wrong_quotes.rs+++ /dev/null@@ -1,42 +0,0 @@-use super::{Lint, Linter, Suggestion};-use crate::document::Document;-use crate::{Token, TokenStringExt};--#[derive(Debug, Clone, Copy, Default)]-pub struct WrongQuotes;--impl Linter for WrongQuotes {- fn lint(&mut self, document: &Document) -> Vec<Lint> {- document- .iter_quote_indices()- .zip(document.iter_quotes())- .filter_map(|(quote_idx, quote_token)| lint_quote(document, quote_idx, quote_token))- .collect()- }-- fn description(&self) -> &'static str {- "The key on the keyboard often used as a quotation mark is actually a double-apostrophe. Use the correct character."- }-}--fn lint_quote(document: &Document, quote_idx: usize, quote_token: &Token) -> Option<Lint> {- let quote = quote_token.kind.as_quote().unwrap();-- let twin_loc = quote.twin_loc?;- let is_left = twin_loc > quote_idx;-- let quote_char = *document.get_span_content("e_token.span).first()?;-- let should_be = if is_left { '“' } else { '”' };-- if quote_char != should_be {- Some(Lint {- span: quote_token.span,- suggestions: vec![Suggestion::ReplaceWith(vec![should_be])],- message: "Use the better-formatted quote character.".to_string(),- ..Default::default()- })- } else {- None- }-}