Skip to content

Proper noun caps australia #651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions harper-core/src/linting/lint_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ use super::plural_conjugate::PluralConjugate;
use super::possessive_your::PossessiveYour;
use super::pronoun_contraction::PronounContraction;
use super::proper_noun_capitalization_linters::{
AmazonNames, Americas, AppleNames, AzureNames, ChineseCommunistParty, GoogleNames, Holidays,
Koreas, MetaNames, MicrosoftNames, UnitedOrganizations,
AmazonNames, Americas, AppleNames, Australia, AzureNames, ChineseCommunistParty, GoogleNames,
Holidays, Koreas, MetaNames, MicrosoftNames, UnitedOrganizations,
};
use super::repeated_words::RepeatedWords;
use super::sentence_capitalization::SentenceCapitalization;
Expand Down Expand Up @@ -244,6 +244,7 @@ create_lint_group_config!(
ThatWhich => true,
CapitalizePersonalPronouns => true,
Americas => true,
Australia => true,
Koreas => true,
ChineseCommunistParty => true,
UnitedOrganizations => true,
Expand Down
4 changes: 2 additions & 2 deletions harper-core/src/linting/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ pub use plural_conjugate::PluralConjugate;
pub use possessive_your::PossessiveYour;
pub use pronoun_contraction::PronounContraction;
pub use proper_noun_capitalization_linters::{
AmazonNames, Americas, AppleNames, AzureNames, ChineseCommunistParty, GoogleNames, Holidays,
Koreas, MetaNames, MicrosoftNames, UnitedOrganizations,
AmazonNames, Americas, AppleNames, Australia, AzureNames, ChineseCommunistParty, GoogleNames,
Holidays, Koreas, MetaNames, MicrosoftNames, UnitedOrganizations,
};
pub use repeated_words::RepeatedWords;
pub use sentence_capitalization::SentenceCapitalization;
Expand Down
61 changes: 61 additions & 0 deletions harper-core/src/linting/proper_noun_capitalization_linters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,67 @@ create_linter_for!(
"When referring to the continents, make sure to treat them as a proper noun."
);

create_linter_for!(
Australia,
EitherPattern::new(vec![
// the states and territories
Box::new(
SequencePattern::default()
.t_aco("Australian")
.then_whitespace()
.t_aco("Capital")
.then_whitespace()
.t_aco("Territory")
),
Box::new(
SequencePattern::default()
.t_aco("New")
.then_whitespace()
.t_aco("South")
.then_whitespace()
.t_aco("Wales")
),
Box::new(
SequencePattern::default()
.t_aco("Northern")
.then_whitespace()
.t_aco("Territory")
),
Box::new(
SequencePattern::default()
.t_aco("South")
.then_whitespace()
.t_aco("Australia")
),
Box::new(
SequencePattern::default()
.t_aco("Western")
.then_whitespace()
.t_aco("Australia")
),
// major cities
Box::new(
SequencePattern::default()
.t_aco("Alice")
.then_whitespace()
.t_aco("Springs")
),
Box::new(
SequencePattern::default()
.t_aco("Gold")
.then_whitespace()
.t_aco("Coast")
),
Box::new(
SequencePattern::default()
.t_aco("Sunshine")
.then_whitespace()
.t_aco("Coast")
),
]),
"When referring to the states of Australia, make sure to treat them as a proper noun."
);

create_linter_for!(
Koreas,
SequencePattern::default()
Expand Down