Skip to content

Commit aaf7e14

Browse files
feat: last ditched/ditch→last-ditch (Automattic#1147)
* feat: last ditched/ditch→last-ditch * fix: unit test names didn't quite match tests --------- Co-authored-by: Elijah Potter <[email protected]>
1 parent 7ce6acd commit aaf7e14

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

harper-core/src/linting/phrase_corrections.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,12 @@ pub fn lint_group() -> LintGroup {
11291129
"A more vivid adjective would better convey intense hunger.",
11301130
"Encourages vivid writing by suggesting `starving` instead of weaker expressions like `very hungry.`"
11311131
),
1132+
"LastDitch" => (
1133+
["last ditch", "last ditched", "last-ditched"],
1134+
["last-ditch"],
1135+
"In this idiom, `ditch` is a noun and a hyphen is needed.",
1136+
"Corrects wrong variations of the idiomatic adjective `last-ditch`."
1137+
),
11321138
"InvestIn" => (
11331139
["invest into"],
11341140
["invest in"],
@@ -2402,6 +2408,15 @@ mod tests {
24022408
);
24032409
}
24042410

2411+
#[test]
2412+
fn correct_last_ditched() {
2413+
assert_suggestion_result(
2414+
"I was actually just trying that as a last ditched attempt to get it working, previously those ...",
2415+
lint_group(),
2416+
"I was actually just trying that as a last-ditch attempt to get it working, previously those ...",
2417+
);
2418+
}
2419+
24052420
#[test]
24062421
fn corrects_invested_into() {
24072422
assert_suggestion_result(
@@ -2411,6 +2426,15 @@ mod tests {
24112426
);
24122427
}
24132428

2429+
#[test]
2430+
fn correct_last_ditch_space() {
2431+
assert_suggestion_result(
2432+
"There are unique use cases and is meant to be a last ditch option.",
2433+
lint_group(),
2434+
"There are unique use cases and is meant to be a last-ditch option.",
2435+
);
2436+
}
2437+
24142438
#[test]
24152439
fn corrects_invest_into() {
24162440
assert_suggestion_result(

0 commit comments

Comments
 (0)