Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

feat: reimplement feat: forms of "get rid off" -> "rid of"

hippietraildc7097d03011
diff --git a/harper-core/src/linting/lint_group.rs b/harper-core/src/linting/lint_group.rs
index 19f921e18..ef19a7cb5 100644
--- a/harper-core/src/linting/lint_group.rs
+++ b/harper-core/src/linting/lint_group.rs
@@ -46,9 +46,10 @@ use super::phrase_corrections::MutePoint;
use super::phrase_corrections::StateOfTheArt;
use super::phrase_corrections::WantBe;
use super::phrase_corrections::{
- AndTheLike, BadRap, BatedBreath, BeckAndCall, ChangeTack, EnMasse, HumanLife, HungerPang,
- LetAlone, LoAndBehold, NeedHelp, NoLonger, OfCourse, SneakingSuspicion, SpecialAttention,
- SupposedTo, ThanOthers, ThatChallenged, TurnItOff,
+ AndTheLike, BadRap, BatedBreath, BeckAndCall, ChangeTack, EnMasse, GetRidOff, GetsRidOff,
+ GettingRidOff, GotRidOff, HumanLife, HungerPang, LetAlone, LoAndBehold, NeedHelp, NoLonger,
+ OfCourse, SneakingSuspicion, SpecialAttention, SupposedTo, ThanOthers, ThatChallenged,
+ TurnItOff,
};
use super::pique_interest::PiqueInterest;
use super::plural_conjugate::PluralConjugate;
@@ -335,7 +336,11 @@ create_lint_group_config!(
SpecialAttention => true,
Everywhere => true,
ThanOthers => true,
- SupposedTo => true
+ SupposedTo => true,
+ GetRidOff => true,
+ GetsRidOff => true,
+ GettingRidOff => true,
+ GotRidOff => true
);
impl<T: Dictionary + Default> Default for LintGroup<T> {
diff --git a/harper-core/src/linting/mod.rs b/harper-core/src/linting/mod.rs
index 25b3aeef7..5a532fc10 100644
--- a/harper-core/src/linting/mod.rs
+++ b/harper-core/src/linting/mod.rs
@@ -112,9 +112,10 @@ pub use phrase_corrections::MutePoint;
pub use phrase_corrections::StateOfTheArt;
pub use phrase_corrections::WantBe;
pub use phrase_corrections::{
- AndTheLike, BadRap, BatedBreath, BeckAndCall, ChangeTack, EnMasse, HumanLife, HungerPang,
- LetAlone, LoAndBehold, NeedHelp, NoLonger, OfCourse, SneakingSuspicion, SpecialAttention,
- SupposedTo, ThanOthers, ThatChallenged, TurnItOff,
+ AndTheLike, BadRap, BatedBreath, BeckAndCall, ChangeTack, EnMasse, GetRidOff, GetsRidOff,
+ GettingRidOff, GotRidOff, HumanLife, HungerPang, LetAlone, LoAndBehold, NeedHelp, NoLonger,
+ OfCourse, SneakingSuspicion, SpecialAttention, SupposedTo, ThanOthers, ThatChallenged,
+ TurnItOff,
};
pub use pique_interest::PiqueInterest;
pub use plural_conjugate::PluralConjugate;
diff --git a/harper-core/src/linting/phrase_corrections.rs b/harper-core/src/linting/phrase_corrections.rs
index 83e125fd4..f1fc56382 100644
--- a/harper-core/src/linting/phrase_corrections.rs
+++ b/harper-core/src/linting/phrase_corrections.rs
@@ -139,6 +139,35 @@ create_linter_map_phrase!(MutePoint, ExactPhrase::from_phrase("mute point"),
"Did you mean `moot point`?",
"Ensures `moot point` is used instead of `mute point`, as `moot` means debatable or irrelevant.");
+create_linter_map_phrase!(
+ GetRidOff,
+ ExactPhrase::from_phrase("get rid off"),
+ "get rid of",
+ "Did you mean `get rid of`?",
+ "Ensures `get rid of` is used instead of `get rid off`."
+);
+create_linter_map_phrase!(
+ GetsRidOff,
+ ExactPhrase::from_phrase("gets rid off"),
+ "gets rid of",
+ "Did you mean `gets rid of`?",
+ "Ensures `gets rid of` is used instead of `gets rid off`."
+);
+create_linter_map_phrase!(
+ GettingRidOff,
+ ExactPhrase::from_phrase("getting rid off"),
+ "getting rid of",
+ "Did you mean `getting rid of`?",
+ "Ensures `getting rid of` is used instead of `getting rid off`."
+);
+create_linter_map_phrase!(
+ GotRidOff,
+ ExactPhrase::from_phrase("got rid off"),
+ "got rid of",
+ "Did you mean `got rid of`?",
+ "Ensures `got rid of` is used instead of `got rid off`."
+);
+
#[cfg(test)]
mod tests {
use crate::linting::tests::{assert_lint_count, assert_suggestion_result};
@@ -148,6 +177,33 @@ mod tests {
SneakingSuspicion, SpecialAttention, SupposedTo, ThanOthers, TurnItOff,
};
+ // todo: 4 tests: get/gets/getting rid off
+ #[test]
+ fn get_rid_off() {
+ assert_suggestion_result(
+ "Please bump axios version to get rid off npm warning #624",
+ GetRidOff::default(),
+ "Please bump axios version to get rid of npm warning #624",
+ );
+ }
+ fn gets_rid_off() {
+ assert_suggestion_result(
+ "Adding at as a runtime dependency gets rid off that error",
+ GetsRidOff::default(),
+ "Adding at as a runtime dependency gets rid of that error",
+ );
+ }
+ fn getting_rid_off() {
+ assert_suggestion_result("getting rid off of all the complexity of the different accesses method of API service providers", GettingRidOff::default(), "getting rid of of all the complexity of the different accesses method of API service providers");
+ }
+ fn got_rid_off() {
+ assert_suggestion_result(
+ "For now we got rid off circular deps in model tree structure and it's API.",
+ GotRidOff::default(),
+ "For now we got rid of circular deps in model tree structure and it's API.",
+ );
+ }
+
#[test]
fn issue_574() {
assert_lint_count("run by one", TurnItOff::default(), 0);