Skip to content

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

Merge branch 'master' into add-rules

Elijah Pottera65fde40b36a
diff --cc harper-core/src/linting/phrase_corrections.rs
index 68090691e,4a7ce043e..695c01c7d
--- a/harper-core/src/linting/phrase_corrections.rs
+++ b/harper-core/src/linting/phrase_corrections.rs
@@@ -923,18 -923,18 +923,30 @@@ pub fn lint_group() -> LintGroup
"Use `without` instead of `w/o`",
"Expands the abbreviation `w/o` to the full word `without` for clarity."
),
+ "OnSecondThought" => (
+ ["on second though"],
+ ["on second thought"],
+ "Idiomatic expression: use `on second thought` instead of `on second though`",
+ "Replaces the nonstandard `on second though` with the common idiom `on second thought` to indicate reconsideration."
+ ),
+ "Excellent" => (
+ ["very good"],
+ ["excellent"],
+ "Vocabulary enhancement: use `excellent` instead of `very good`",
+ "Provides a stronger word choice by replacing `very good` with `excellent` for clarity and emphasis."
+ ),
+ "ExpandBecause" => (
+ ["cuz"],
+ ["because"],
+ "Use `because` instead of informal `cuz`",
+ "Expands the informal abbreviation `cuz` to the full word `because` for formality."
+ ),
+ "AtFaceValue" => (
+ ["on face value"],
+ ["at face value"],
+ "`at face value is more idiomatic and more common.",
+ "Corrects `on face value` to the more usual `at face value`."
+ ),
});
group.set_all_rules_to(Some(true));
@@@ -1768,57 -1768,21 +1780,75 @@@ mod tests
);
}
+ #[test]
+ fn on_second_thought_clean() {
+ assert_lint_count(
+ "She considered driving home, but on second thought, she decided to walk.",
+ lint_group(),
+ 0,
+ );
+ }
+
+ #[test]
+ fn on_second_thought_incorrect() {
+ assert_suggestion_result(
+ "I was going to buy it, but on second though, maybe I'll wait.",
+ lint_group(),
+ "I was going to buy it, but on second thought, maybe I'll wait.",
+ );
+ }
+
+ #[test]
+ fn expand_cuz() {
+ assert_suggestion_result(
+ "Stick around cuz I got a surprise for you at the end.",
+ lint_group(),
+ "Stick around because I got a surprise for you at the end.",
+ );
+ }
+
+ #[test]
+ fn on_second_thought_no_false_positive() {
+ assert_lint_count(
+ "My second though is that I'd prefer something else entirely.",
+ lint_group(),
+ 0,
+ );
+ }
+
+ #[test]
+ fn excellent_clean() {
+ assert_lint_count(
+ "The performance was excellent, drawing praise from all critics.",
+ lint_group(),
+ 0,
+ );
+ }
+
+ #[test]
+ fn excellent_incorrect() {
+ assert_suggestion_result(
+ "Her results were very good this semester.",
+ lint_group(),
+ "Her results were excellent this semester.",
+ );
+ }
+
+ #[test]
+ fn excellent_no_false_positive() {
+ assert_lint_count(
+ "He radiated a sense of very goodness in his charitable acts.",
+ lint_group(),
+ 0,
+ );
+ }
++
+ #[test]
+ fn correct_on_face_value() {
+ assert_suggestion_result(
+ "Obviously what you want is possible and on face value it's a trivial change on our end.",
+ lint_group(),
+ "Obviously what you want is possible and at face value it's a trivial change on our end.",
+ );
+ }
}