Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions harper-core/src/linting/phrase_corrections/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ pub fn lint_group() -> LintGroup {
"Prefer the single-word adverb `beforehand`.",
"`Beforehand` functions as a fixed adverb meaning ‘in advance’; writing it as two words or with a hyphen is nonstandard and can jar readers."
),
"BesideThePoint" => (
["besides the point"],
["beside the point"],
"Use `beside` in the idiom `beside the point`.",
"Corrects `besides the point` to `beside the point`.",
LintKind::Eggcorn
),
"BestRegards" => (
["beat regards"],
["best regards"],
Expand Down Expand Up @@ -328,6 +335,13 @@ pub fn lint_group() -> LintGroup {
"In English, negation still requires the complete verb form (“want”), so avoid truncating it to “wan.”",
LintKind::Typo
),
"DontCan" => (
["don't can"],
["can't", "cannot"],
"The grammatically correct form is `can't` or `cannot`.",
"Corrects `don't can` to `can't` or `cannot`.",
LintKind::Grammar
),
"EachAndEveryOne" => (
["each and everyone"],
["each and every one"],
Expand Down
31 changes: 26 additions & 5 deletions harper-core/src/linting/phrase_corrections/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,16 @@ fn allows_beforehand() {
assert_lint_count("We finished the preparations beforehand.", lint_group(), 0);
}

// BesideThePoint
#[test]
fn beside_the_point() {
assert_suggestion_result(
"we kind of focus on GPUs a lot but uh that's besides the point so uh sometime ago",
lint_group(),
"we kind of focus on GPUs a lot but uh that's beside the point so uh sometime ago",
);
}

// BestRegards
// -none-

Expand Down Expand Up @@ -334,6 +344,13 @@ fn does_not_flag_other_contexts() {
// DayAndAge
// -none

// DegreesKelvin
#[test]
fn corrects_degrees_kelvin() {
assert_suggestion_result("degrees kelvin", lint_group(), "kelvins");
assert_suggestion_result("°K", lint_group(), "K");
}

// DoNotWant
#[test]
fn corrects_dont_wan() {
Expand All @@ -354,14 +371,18 @@ fn corrects_mixed_case() {
}

#[test]
fn corrects_degrees_kelvin() {
assert_suggestion_result("degrees kelvin", lint_group(), "kelvins");
assert_suggestion_result("°K", lint_group(), "K");
fn does_not_flag_already_correct() {
assert_lint_count("I don't want to leave.", lint_group(), 0);
}

// DontCan
#[test]
fn does_not_flag_already_correct() {
assert_lint_count("I don't want to leave.", lint_group(), 0);
fn corrects_dont_can() {
assert_suggestion_result(
"And currently uh I'm looking at it when I don't can see it like you know where it is, right?",
lint_group(),
"And currently uh I'm looking at it when I can't see it like you know where it is, right?",
);
}

// EachAndEveryOne
Expand Down
Loading