Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
Merge branch 'master' of https://github.com/Automattic/harper into yet-more-adj-of-a-false-positives
hippietrail2c1fac27c990
diff --cc harper-core/src/linting/adjective_of_a.rsindex 7c2707fdc,2ff82a562..704645165--- a/harper-core/src/linting/adjective_of_a.rs+++ b/harper-core/src/linting/adjective_of_a.rs@@@ -19,19 -19,20 +19,22 @@@ impl Linter for AdjectiveOfA// Rule out false positives- // Different valid constructions.- if adj_chars == ['i', 'n', 's', 'i', 'd', 'e']- || adj_chars == ['m', 'u', 'c', 'h']- || adj_chars == ['o', 'u', 't']+ if match adj_chars {- // "much of a" is a different and valid construction.++ // Different valid constructions.++ ['i', 'n', 's', 'i', 'd', 'e'] | ['I', 'n', 's', 'i', 'd', 'e'] => true,+ ['m', 'u', 'c', 'h'] | ['M', 'u', 'c', 'h'] => true,++ ['o', 'u', 't'] | ['O', 'u', 't'] => true,// The word is used more as a noun in this context.// (using .kind.is_likely_homograph() here is too strict)- || adj_chars == ['k', 'i', 'n', 'd']- || adj_chars == ['m', 'e', 'a', 'n', 'i', 'n', 'g']- || adj_chars == ['p', 'a', 'r', 't']- {+ ['f', 'r', 'o', 'n', 't'] | ['F', 'r', 'o', 'n', 't'] => true,+ ['k', 'i', 'n', 'd'] | ['K', 'i', 'n', 'd'] => true,+ ['m', 'e', 'a', 'n', 'i', 'n', 'g'] | ['M', 'e', 'a', 'n', 'i', 'n', 'g'] => true,+ ['p', 'a', 'r', 't'] | ['P', 'a', 'r', 't'] => true,+ // TODO: consider "more of a" and "less of a"+ _ => false,+ } {continue;}-// Rule out comparatives and superlatives.// Pros:@@@ -179,21 -180,12 +182,30 @@@ mod tests);}+ #[test]- fn dont_flag_false_positive_upper() {++ fn dont_flag_part_uppercase() {+ assert_lint_count(+ "Quarkus Extension as Part of a Project inside a Monorepo?",+ AdjectiveOfA,+ 0,+ );+ }+++ #[test]+ fn dont_flag_inside() {+ assert_lint_count(+ "Michael and Brock sat inside of a diner in Brandon",+ AdjectiveOfA,+ 0,+ );+ }++ #[test]+ fn dont_flag_out() {+ assert_lint_count(+ "not only would he potentially be out of a job and back to sort of poverty",+ AdjectiveOfA,+ 0,+ );+ }}