Skip to content

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

feat(core): create individual linters for specific products

Elijah Potter14f3fdcc1c20
diff --git a/harper-core/dictionary.dict b/harper-core/dictionary.dict
index c72f82fb9..02cabec8f 100644
--- a/harper-core/dictionary.dict
+++ b/harper-core/dictionary.dict
@@ -49930,3 +49930,11 @@ RTX/1SM
PDP/1SM
Jetpack/M
learnt/4
+WooCommerce/M
+Tumblr/M
+Akismet/M
+Simplenote/M
+Longreads/M
+VaultPress/M
+Gravatar/M
+Crowdsignal/M
diff --git a/harper-core/src/linting/lint_group.rs b/harper-core/src/linting/lint_group.rs
index a73249445..e959e5b24 100644
--- a/harper-core/src/linting/lint_group.rs
+++ b/harper-core/src/linting/lint_group.rs
@@ -55,7 +55,9 @@ 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::JetpackNames;
+use super::proper_noun_capitalization_linters::PocketCastsNames;
+use super::proper_noun_capitalization_linters::TumblrNames;
use super::proper_noun_capitalization_linters::{
AmazonNames, Americas, AppleNames, Australia, AzureNames, Canada, ChineseCommunistParty,
GoogleNames, Holidays, Koreas, Malaysia, MetaNames, MicrosoftNames, UnitedOrganizations,
@@ -196,7 +198,9 @@ macro_rules! create_lint_group_config {
}
create_lint_group_config!(
- AutomatticNames => true,
+ PocketCastsNames => true,
+ TumblrNames => true,
+ JetpackNames => true,
OutOfDate => true,
Desktop => true,
Laptop => true,
diff --git a/harper-core/src/linting/mod.rs b/harper-core/src/linting/mod.rs
index 840a1a87b..243af2a7c 100644
--- a/harper-core/src/linting/mod.rs
+++ b/harper-core/src/linting/mod.rs
@@ -117,7 +117,9 @@ 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::JetpackNames;
+pub use proper_noun_capitalization_linters::PocketCastsNames;
+pub use proper_noun_capitalization_linters::TumblrNames;
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 69bd69b14..aaf7916dc 100644
--- a/harper-core/src/linting/proper_noun_capitalization_linters.rs
+++ b/harper-core/src/linting/proper_noun_capitalization_linters.rs
@@ -685,25 +685,114 @@ create_linter_for!(
);
create_linter_for!(
- AutomatticNames,
+ JetpackNames,
SequencePattern::default()
- .t_aco("Automattic")
+ .t_aco("Jetpack")
.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."
+ .then(Box::new(EitherPattern::new(vec![
+ Box::new(SequencePattern::default()
+ .t_aco("VaultPress")
+ .then_whitespace()
+ .t_aco("Backup")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("VaultPress")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("Scan")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("Akismet")
+ .then_whitespace()
+ .t_aco("Anti-spam")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("Stats")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("Social")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("Blaze")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("AI")
+ .then_whitespace()
+ .t_aco("Assistant")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("Site")
+ .then_whitespace()
+ .t_aco("Search")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("Boost")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("VideoPress")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("For")
+ .then_whitespace()
+ .t_aco("Agencies")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("CRM")
+ ),
+ ]))),
+ "Ensure proper capitalization of Jetpack-related terms, including products and features such as Jetpack VaultPress Backup, Jetpack Blaze, and Jetpack AI Assistant."
+);
+
+create_linter_for!(
+ TumblrNames,
+ SequencePattern::default()
+ .t_aco("Tumblr")
+ .then_whitespace()
+ .then(Box::new(EitherPattern::new(vec![
+ Box::new(SequencePattern::default()
+ .t_aco("Blaze")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("Pro")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("Live")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("Ads")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("Communities")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("Shop")
+ ),
+ Box::new(SequencePattern::default()
+ .t_aco("Dashboard")
+ )
+ ]))),
+ "Ensure proper capitalization of Tumblr-related terms, including products and features such as Tumblr Blaze, Tumblr Post+, and Tumblr Communities."
+);
+
+create_linter_for!(
+ PocketCastsNames,
+ EitherPattern::new(vec![
+ Box::new(
+ SequencePattern::default()
+ .t_aco("Pocket")
+ .then_whitespace()
+ .t_aco("Casts")
+ ),
+ Box::new(
+ SequencePattern::default()
+ .t_aco("Pocket")
+ .then_whitespace()
+ .t_aco("Casts")
+ .then_whitespace()
+ .t_aco("Plus")
+ )
+ ]),
+ "Ensure proper capitalization of Pocket Casts and Pocket Casts Plus as brand names."
);
#[cfg(test)]