Skip to content

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

feat(core): add Automattic-specific rules

Elijah Pottercd95b66fe171
diff --git a/harper-core/dictionary.dict b/harper-core/dictionary.dict
index 3dcca9986..c72f82fb9 100644
--- a/harper-core/dictionary.dict
+++ b/harper-core/dictionary.dict
@@ -49928,3 +49928,5 @@ backplane/SM
cyberattack/SM
RTX/1SM
PDP/1SM
+Jetpack/M
+learnt/4
diff --git a/harper-core/src/linting/lint_group.rs b/harper-core/src/linting/lint_group.rs
index 55ca43d0c..a73249445 100644
--- a/harper-core/src/linting/lint_group.rs
+++ b/harper-core/src/linting/lint_group.rs
@@ -55,6 +55,7 @@ use super::pique_interest::PiqueInterest;
use super::plural_conjugate::PluralConjugate;
use super::possessive_your::PossessiveYour;
use super::pronoun_contraction::PronounContraction;
+use super::proper_noun_capitalization_linters::AutomatticNames;
use super::proper_noun_capitalization_linters::{
AmazonNames, Americas, AppleNames, Australia, AzureNames, Canada, ChineseCommunistParty,
GoogleNames, Holidays, Koreas, Malaysia, MetaNames, MicrosoftNames, UnitedOrganizations,
@@ -195,6 +196,7 @@ macro_rules! create_lint_group_config {
}
create_lint_group_config!(
+ AutomatticNames => true,
OutOfDate => true,
Desktop => true,
Laptop => true,
diff --git a/harper-core/src/linting/mod.rs b/harper-core/src/linting/mod.rs
index 05f2be2cd..840a1a87b 100644
--- a/harper-core/src/linting/mod.rs
+++ b/harper-core/src/linting/mod.rs
@@ -117,6 +117,7 @@ pub use pique_interest::PiqueInterest;
pub use plural_conjugate::PluralConjugate;
pub use possessive_your::PossessiveYour;
pub use pronoun_contraction::PronounContraction;
+pub use proper_noun_capitalization_linters::AutomatticNames;
pub use proper_noun_capitalization_linters::{
AmazonNames, Americas, AppleNames, Australia, AzureNames, Canada, ChineseCommunistParty,
GoogleNames, Holidays, Koreas, Malaysia, MetaNames, MicrosoftNames, UnitedOrganizations,
diff --git a/harper-core/src/linting/proper_noun_capitalization_linters.rs b/harper-core/src/linting/proper_noun_capitalization_linters.rs
index 2424d57f1..69bd69b14 100644
--- a/harper-core/src/linting/proper_noun_capitalization_linters.rs
+++ b/harper-core/src/linting/proper_noun_capitalization_linters.rs
@@ -684,6 +684,28 @@ create_linter_for!(
"When referring to Meta products and services, make sure to treat them as proper nouns."
);
+create_linter_for!(
+ AutomatticNames,
+ SequencePattern::default()
+ .t_aco("Automattic")
+ .then_whitespace()
+ .then(Box::new(EitherPattern::new(vec![Box::new(WordSet::all(
+ &[
+ "WordPress",
+ "WooCommerce",
+ "Jetpack",
+ "Tumblr",
+ "Akismet",
+ "Simplenote",
+ "Longreads",
+ "VaultPress",
+ "Gravatar",
+ "Crowdsignal",
+ ]
+ ))]))),
+ "When referring to Automattic products and services, make sure to treat them as proper nouns."
+);
+
#[cfg(test)]
mod tests {
use crate::linting::tests::{assert_lint_count, assert_suggestion_result};