Skip to content

Commit c998293

Browse files
Merge pull request #895 from hippietrail/explanation-mark
feat: flag "explanation mark/point" instead of "exclamation"
2 parents 6a8f9f6 + e46e296 commit c998293

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

harper-core/src/linting/phrase_corrections.rs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,24 @@ pub fn lint_group() -> LintGroup {
721721
"Retain `monumentous` for jocular effect. Otherwise `momentous` indicates great signifcance while `monumental` indicates imposing size.",
722722
"Advises using `momentous` or `monumental` instead of `monumentous` for serious usage."
723723
),
724+
"ExplanationMark" => (
725+
["explanation mark"],
726+
["exclamation mark"],
727+
"The correct name for the `!` punctuation is `exclamation mark`.",
728+
"Corrects the eggcorn `explanation mark` to `exclamation mark`."
729+
),
730+
"ExplanationMarks" => (
731+
["explanation marks"],
732+
["exclamation marks"],
733+
"The correct name for the `!` punctuation is `exclamation mark`.",
734+
"Corrects the eggcorn `explanation mark` to `exclamation mark`."
735+
),
736+
"ExplanationPoint" => (
737+
["explanation point"],
738+
["exclamation point"],
739+
"The correct name for the `!` punctuation is `exclamation point`.",
740+
"Corrects the eggcorn `explanation point` to `exclamation point`."
741+
),
724742
"AsFarBackAs" => (
725743
["as early back as"],
726744
["as far back as"],
@@ -1203,6 +1221,48 @@ mod tests {
12031221
);
12041222
}
12051223

1224+
#[test]
1225+
fn detect_explanation_mark_atomic() {
1226+
assert_suggestion_result("explanation mark", lint_group(), "exclamation mark");
1227+
}
1228+
1229+
#[test]
1230+
fn detect_explanation_marks_atomic() {
1231+
assert_suggestion_result("explanation marks", lint_group(), "exclamation marks");
1232+
}
1233+
1234+
#[test]
1235+
fn detect_explanation_mark_real_world() {
1236+
assert_suggestion_result(
1237+
"Note that circled explanation mark, question mark, plus and arrows may be significantly harder to distinguish than their uncircled variants.",
1238+
lint_group(),
1239+
"Note that circled exclamation mark, question mark, plus and arrows may be significantly harder to distinguish than their uncircled variants.",
1240+
);
1241+
}
1242+
1243+
#[test]
1244+
fn detect_explanation_marks_real_world() {
1245+
assert_suggestion_result(
1246+
"this issue: html: properly handle explanation marks in comments",
1247+
lint_group(),
1248+
"this issue: html: properly handle exclamation marks in comments",
1249+
);
1250+
}
1251+
1252+
#[test]
1253+
fn detect_explanation_point_atomic() {
1254+
assert_suggestion_result("explanation point", lint_group(), "exclamation point");
1255+
}
1256+
1257+
#[test]
1258+
fn detect_explanation_point_real_world() {
1259+
assert_suggestion_result(
1260+
"js and makes an offhand mention that you can disable inbuilt plugin with an explanation point (e.g. !error ).",
1261+
lint_group(),
1262+
"js and makes an offhand mention that you can disable inbuilt plugin with an exclamation point (e.g. !error ).",
1263+
);
1264+
}
1265+
12061266
#[test]
12071267
fn detect_as_early_back_as() {
12081268
assert_suggestion_result("as early back as", lint_group(), "as far back as");

0 commit comments

Comments
 (0)