Skip to content

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

Merge branch 'master' into add-rules

Elijah Potterc005f37a4382
diff --cc harper-core/src/linting/phrase_corrections.rs
index 695c01c7d,f0bd76267..680cac9ca
--- a/harper-core/src/linting/phrase_corrections.rs
+++ b/harper-core/src/linting/phrase_corrections.rs
@@@ -923,18 -923,13 +923,25 @@@ 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."
+ ),
+ "WellKept" => (
+ ["highly-kept", "highly kept"],
+ // There may be other good alternatives such as closely-guarded or tightly-held
+ ["well-kept"],
+ "`Highly-kept` is not standard. To describe secrets, `well-kept` is the most used phrase.",
+ "Flags `highly-kept` and recommends `well-kept` as an alternative."
+ ),
"ExpandBecause" => (
["cuz"],
["because"],
@@@ -1780,24 -1781,15 +1793,33 @@@ 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 correct_highly_kept_space() {
+ assert_suggestion_result(
+ "I assure you that frequency/angle dependence is a highly kept secret.",
+ lint_group(),
+ "I assure you that frequency/angle dependence is a well-kept secret.",
+ );
+ }
+
#[test]
fn expand_cuz() {
assert_suggestion_result(
@@@ -1807,42 -1799,15 +1829,51 @@@
);
}
+ #[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_highly_kept_no_hyphen() {
+ assert_suggestion_result(
+ "Well, Kushina's giving birth was already a highly-kept secret so it makes sense to operate with only the completely necessary personnel.",
+ lint_group(),
+ "Well, Kushina's giving birth was already a well-kept secret so it makes sense to operate with only the completely necessary personnel.",
+ );
+ }
+
#[test]
fn correct_on_face_value() {
assert_suggestion_result(