Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(core): remove the malfunctioning `TerminatingConjunctions` rule
Elijah Potter657b329b8a5b
diff --git a/harper-core/src/linting/lint_group.rs b/harper-core/src/linting/lint_group.rsindex 2b60c6ca0..96c7cc52b 100644--- a/harper-core/src/linting/lint_group.rs+++ b/harper-core/src/linting/lint_group.rs@@ -57,7 +57,6 @@ use super::somewhat_something::SomewhatSomething;use super::spaces::Spaces;use super::spell_check::SpellCheck;use super::spelled_numbers::SpelledNumbers;-use super::terminating_conjunctions::TerminatingConjunctions;use super::that_which::ThatWhich;use super::then_than::ThenThan;use super::unclosed_quotes::UnclosedQuotes;@@ -327,7 +326,6 @@ impl LintGroup {insert_pattern_rule!(MultipleSequentialPronouns, true);insert_struct_rule!(LinkingVerbs, false);insert_struct_rule!(AvoidCurses, true);- insert_pattern_rule!(TerminatingConjunctions, true);insert_struct_rule!(EllipsisLength, true);insert_struct_rule!(CommaFixes, true);insert_pattern_rule!(DotInitialisms, true);diff --git a/harper-core/src/linting/mod.rs b/harper-core/src/linting/mod.rsindex d26aa20f5..46d8661e4 100644--- a/harper-core/src/linting/mod.rs+++ b/harper-core/src/linting/mod.rs@@ -60,7 +60,6 @@ mod spaces;mod spell_check;mod spelled_numbers;mod suggestion;-mod terminating_conjunctions;mod that_which;mod then_than;mod unclosed_quotes;@@ -123,7 +122,6 @@ pub use spaces::Spaces;pub use spell_check::SpellCheck;pub use spelled_numbers::SpelledNumbers;pub use suggestion::Suggestion;-pub use terminating_conjunctions::TerminatingConjunctions;pub use that_which::ThatWhich;pub use then_than::ThenThan;pub use unclosed_quotes::UnclosedQuotes;diff --git a/harper-core/src/linting/terminating_conjunctions.rs b/harper-core/src/linting/terminating_conjunctions.rsdeleted file mode 100644index b8b94411b..000000000--- a/harper-core/src/linting/terminating_conjunctions.rs+++ /dev/null@@ -1,99 +0,0 @@-use super::{Lint, LintKind, PatternLinter};-use crate::patterns::{ConsumesRemainingPattern, Pattern, SequencePattern, WordSet};--pub struct TerminatingConjunctions {- pattern: Box<dyn Pattern>,-}--impl Default for TerminatingConjunctions {- fn default() -> Self {- Self {- pattern: Box::new(ConsumesRemainingPattern::new(Box::new(- SequencePattern::default()- .then_anything_but_hyphen()- .then(WordSet::new(&[- "although",- "as",- "because",- "if",- "lest",- "once",- "only",- "since",- "supposing",- "than",- "though",- "till",- "unless",- "until",- "when",- "whenever",- "where",- "whereas",- "wherever",- "whether",- "while",- "or",- "nor",- "and",- ]))- .then_comma(),- ))),- }- }-}--impl PatternLinter for TerminatingConjunctions {- fn pattern(&self) -> &dyn Pattern {- self.pattern.as_ref()- }-- fn match_to_lint(&self, matched_tokens: &[crate::Token], source: &[char]) -> Option<Lint> {- let word_span = matched_tokens[1].span;- let word = word_span.get_content_string(source);-- Some(Lint {- span: word_span,- lint_kind: LintKind::Miscellaneous,- suggestions: vec![],- message: format!(- "Subordinating conjunctions like “{word}” should not appear at the end of a \- clause."- ),- priority: 63,- })- }-- fn description(&self) -> &'static str {- "Subordinating conjunctions are words that create a grammatical space for another idea or clause. As such, they should never appear at the end of a clause."- }-}--#[cfg(test)]-mod tests {- use super::TerminatingConjunctions;- use crate::linting::tests::assert_lint_count;-- #[test]- fn issue_131() {- assert_lint_count(- "More often than, we cannot foresee that of our community.",- TerminatingConjunctions::default(),- 1,- )- }-- #[test]- fn no_false_positive() {- assert_lint_count("Cookies and milk.", TerminatingConjunctions::default(), 0)- }-- #[test]- fn issue_341() {- assert_lint_count(- "The structure has a couple of fields marked read-only, like A and B",- TerminatingConjunctions::default(),- 0,- );- }-}