Skip to content

Commit 1389e80

Browse files
committed
feat: reimplement "operative system(s)"
Moved from `matcher.rs` to `phrase_corrections.rs`. Was previously part of PR Automattic#685 with other lints.
1 parent 6b8b351 commit 1389e80

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

harper-core/src/linting/lint_group.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ use super::phrase_corrections::StateOfTheArt;
4747
use super::phrase_corrections::WantBe;
4848
use super::phrase_corrections::{
4949
AndTheLike, BadRap, BatedBreath, BeckAndCall, ChangeTack, EnMasse, HumanLife, HungerPang,
50-
LetAlone, LoAndBehold, NeedHelp, NoLonger, OfCourse, SneakingSuspicion, SpecialAttention,
51-
SupposedTo, ThanOthers, ThatChallenged, TurnItOff,
50+
LetAlone, LoAndBehold, NeedHelp, NoLonger, OfCourse, OperativeSystem, OperativeSystems,
51+
SneakingSuspicion, SpecialAttention, SupposedTo, ThanOthers, ThatChallenged, TurnItOff,
5252
};
5353
use super::pique_interest::PiqueInterest;
5454
use super::plural_conjugate::PluralConjugate;
@@ -335,7 +335,9 @@ create_lint_group_config!(
335335
SpecialAttention => true,
336336
Everywhere => true,
337337
ThanOthers => true,
338-
SupposedTo => true
338+
SupposedTo => true,
339+
OperativeSystem => true,
340+
OperativeSystems => true
339341
);
340342

341343
impl<T: Dictionary + Default> Default for LintGroup<T> {

harper-core/src/linting/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ pub use phrase_corrections::StateOfTheArt;
113113
pub use phrase_corrections::WantBe;
114114
pub use phrase_corrections::{
115115
AndTheLike, BadRap, BatedBreath, BeckAndCall, ChangeTack, EnMasse, HumanLife, HungerPang,
116-
LetAlone, LoAndBehold, NeedHelp, NoLonger, OfCourse, SneakingSuspicion, SpecialAttention,
117-
SupposedTo, ThanOthers, ThatChallenged, TurnItOff,
116+
LetAlone, LoAndBehold, NeedHelp, NoLonger, OfCourse, OperativeSystem, OperativeSystems,
117+
SneakingSuspicion, SpecialAttention, SupposedTo, ThanOthers, ThatChallenged, TurnItOff,
118118
};
119119
pub use pique_interest::PiqueInterest;
120120
pub use plural_conjugate::PluralConjugate;

harper-core/src/linting/phrase_corrections.rs

+34-1
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,29 @@ create_linter_map_phrase!(MutePoint, ExactPhrase::from_phrase("mute point"),
139139
"Did you mean `moot point`?",
140140
"Ensures `moot point` is used instead of `mute point`, as `moot` means debatable or irrelevant.");
141141

142+
create_linter_map_phrase!(
143+
OperativeSystem,
144+
ExactPhrase::from_phrase("operative system"),
145+
"operating system",
146+
"Did you mean `operating system`?",
147+
"Ensures `operating system` is used correctly instead of `operative system`."
148+
);
149+
create_linter_map_phrase!(
150+
OperativeSystems,
151+
ExactPhrase::from_phrase("operative systems"),
152+
"operating systems",
153+
"Did you mean `operating systems`?",
154+
"Ensures `operating systems` is used correctly instead of `operative systems`."
155+
);
156+
142157
#[cfg(test)]
143158
mod tests {
144159
use crate::linting::tests::{assert_lint_count, assert_suggestion_result};
145160

146161
use super::{
147162
BadRap, BatedBreath, ChangeTack, EnMasse, HungerPang, LetAlone, LoAndBehold, OfCourse,
148-
SneakingSuspicion, SpecialAttention, SupposedTo, ThanOthers, TurnItOff,
163+
OperativeSystem, OperativeSystems, SneakingSuspicion, SpecialAttention, SupposedTo,
164+
ThanOthers, TurnItOff,
149165
};
150166

151167
#[test]
@@ -262,4 +278,21 @@ mod tests {
262278
0,
263279
);
264280
}
281+
282+
#[test]
283+
fn operative_system() {
284+
assert_suggestion_result(
285+
"COS is a operative system made with the COSMOS Kernel and written in C#, COS its literally the same than MS-DOS but written in C# and open-source.",
286+
OperativeSystem::default(),
287+
"COS is a operating system made with the COSMOS Kernel and written in C#, COS its literally the same than MS-DOS but written in C# and open-source.",
288+
);
289+
}
290+
#[test]
291+
fn operative_systems() {
292+
assert_suggestion_result(
293+
"My dotfiles for my operative systems and other configurations.",
294+
OperativeSystems::default(),
295+
"My dotfiles for my operating systems and other configurations.",
296+
);
297+
}
265298
}

0 commit comments

Comments
 (0)