Skip to content

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

add "chance" and "potential" false positives add a missing test comment potentially confusing tests

hippietrail414e6f52c278
diff --git a/harper-core/src/linting/adjective_of_a.rs b/harper-core/src/linting/adjective_of_a.rs
index b752553ab..e1b025e89 100644
--- a/harper-core/src/linting/adjective_of_a.rs
+++ b/harper-core/src/linting/adjective_of_a.rs
@@ -15,6 +15,7 @@ const FALSE_POSITIVES: &[&str] = &[
// The word is used more as a noun in this context.
// (using .kind.is_likely_homograph() here is too strict)
"bottom",
+ "chance",
"front",
"head",
"kind",
@@ -23,6 +24,7 @@ const FALSE_POSITIVES: &[&str] = &[
"middle",
"one",
"part",
+ "potential",
"shadow",
"short",
"something",
@@ -174,6 +176,7 @@ mod tests {
#[test]
fn dont_flag_kind() {
+ // Adjective as in "a kind person" vs noun as in "A kind of person"
assert_lint_count(
"Log.txt file automatic creation in PWD is kind of an anti-feature",
AdjectiveOfA,
@@ -183,6 +186,7 @@ mod tests {
#[test]
fn dont_flag_part() {
+ // Can be an adjective in e.g. "He is just part owner"
assert_lint_count(
"cannot delete a food that is no longer part of a recipe",
AdjectiveOfA,
@@ -192,6 +196,7 @@ mod tests {
#[test]
fn dont_flag_much() {
+ // "much of" is correct idiomatic usage
assert_lint_count(
"How much of a performance impact when switching from rails to rails-api ?",
AdjectiveOfA,
@@ -201,6 +206,7 @@ mod tests {
#[test]
fn dont_flag_part_uppercase() {
+ // Can be an adjective in e.g. "Part man, part machine"
assert_lint_count(
"Quarkus Extension as Part of a Project inside a Monorepo?",
AdjectiveOfA,
@@ -208,8 +214,19 @@ mod tests {
);
}
+ #[test]
+ fn dont_flag_all_of() {
+ // "all of" is correct idiomatic usage
+ assert_lint_count(
+ "This repository is deprecated. All of its content and history has been moved.",
+ AdjectiveOfA,
+ 0,
+ );
+ }
+
#[test]
fn dont_flag_inside() {
+ // "inside of" is idiomatic usage
assert_lint_count(
"Michael and Brock sat inside of a diner in Brandon",
AdjectiveOfA,
@@ -219,6 +236,7 @@ mod tests {
#[test]
fn dont_flag_out() {
+ // "out of" is correct idiomatic usage
assert_lint_count(
"not only would he potentially be out of a job and back to sort of poverty",
AdjectiveOfA,
@@ -228,6 +246,7 @@ mod tests {
#[test]
fn dont_flag_full() {
+ // "full of" is correct idiomatic usage
assert_lint_count(
"fortunately I happen to have this Tupperware full of an unceremoniously disassembled LED Mac Mini",
AdjectiveOfA,
@@ -237,6 +256,7 @@ mod tests {
#[test]
fn dont_flag_something() {
+ // Can be a noun in e.g. "a certain something"
assert_lint_count(
"Well its popularity seems to be taking something of a dip right now.",
AdjectiveOfA,
@@ -246,6 +266,7 @@ mod tests {
#[test]
fn dont_flag_short() {
+ // Can be a noun in e.g. "use a multimeter to find the short"
assert_lint_count(
"I found one Youtube short of an indonesian girl.",
AdjectiveOfA,
@@ -255,6 +276,7 @@ mod tests {
#[test]
fn dont_flag_bottom() {
+ // Can be an adjective in e.g. "bottom bunk"
assert_lint_count(
"When leaves are just like coming out individually from the bottom of a fruit.",
AdjectiveOfA,
@@ -264,6 +286,7 @@ mod tests {
#[test]
fn dont_flag_left() {
+ // Can be an adjective in e.g. "left hand"
assert_lint_count("and what is left of a 12vt coil", AdjectiveOfA, 0)
}
@@ -274,6 +297,7 @@ mod tests {
#[test]
fn dont_flag_head() {
+ // Can be an adjective in e.g. "the head cook"
assert_lint_count(
"You need to get out if you're the head of an education department and you're not using AI",
AdjectiveOfA,
@@ -283,10 +307,31 @@ mod tests {
#[test]
fn dont_flag_middle() {
+ // Can be an adjective in e.g. "middle child"
assert_lint_count(
"just to get to that part in the middle of a blizzard",
AdjectiveOfA,
0,
);
}
+
+ #[test]
+ fn dont_flag_chance() {
+ // Can be an adjective in e.g. "a chance encounter"
+ assert_lint_count(
+ "products that you overpay for because there are subtle details in the terms and conditions that reduce the size or chance of a payout.",
+ AdjectiveOfA,
+ 0,
+ );
+ }
+
+ #[test]
+ fn dont_flag_potential() {
+ // Can be an adjective in e.g. "a potential candidate"
+ assert_lint_count(
+ "People that are happy to accept it for the potential of a reward.",
+ AdjectiveOfA,
+ 0,
+ );
+ }
}