fix(core): fix problems with the NeedToNoun rule (#2287)

This commit is contained in:
Elijah Potter
2025-12-03 09:56:00 -07:00
committed by GitHub
parent bd319e7130
commit fc87bd518b
6 changed files with 36 additions and 5 deletions

View File

@@ -36986,7 +36986,7 @@ overcharge/VdGSNg
overclock/VGdSN
overcloud/VSGd
overcoat/NgSV
overcome/~VGSN
overcome/~VGS
overcompensate/VdSGn
overcompensation/Nmg
overconfidence/Nmg

View File

@@ -18,8 +18,13 @@ pub struct NeedToNoun {
impl Default for NeedToNoun {
fn default() -> Self {
let postfix_exceptions = LongestMatchOf::new(vec![
Box::new(|tok: &Token, _: &[char]| tok.kind.is_adverb() || tok.kind.is_determiner()),
Box::new(WordSet::new(&["about"])),
Box::new(|tok: &Token, _: &[char]| {
tok.kind.is_adverb()
|| tok.kind.is_determiner()
|| tok.kind.is_unlintable()
|| tok.kind.is_pronoun()
}),
Box::new(WordSet::new(&["about", "it"])),
]);
let exceptions = SequenceExpr::default()
@@ -421,4 +426,28 @@ mod tests {
fn allows_issue_2252() {
assert_no_lints("Things I need to do today:", NeedToNoun::default());
}
#[test]
fn allows_install() {
assert_no_lints(
"You need to install it separately, as it's a standalone application.",
NeedToNoun::default(),
);
}
#[test]
fn allows_lay() {
assert_no_lints(
"Okay, this is a long one, but I feel like I need to lay everything out.",
NeedToNoun::default(),
);
}
#[test]
fn allows_overcome() {
assert_no_lints(
"We believe every family deserves the opportunity to flourish, and we are committed to providing the resources they need to overcome adversity.",
NeedToNoun::default(),
);
}
}

View File

@@ -94,6 +94,7 @@ create_test!(issue_2054_clean.md, 0, Dialect::British);
create_test!(issue_1873.md, 0, Dialect::British);
create_test!(issue_2246.md, 0, Dialect::American);
create_test!(issue_2233.md, 0, Dialect::American);
create_test!(issue_2240.md, 0, Dialect::American);
// It just matters that it is > 1
create_test!(issue_2151.md, 4, Dialect::British);

View File

@@ -0,0 +1 @@
There is no more need to run `git`.

View File

@@ -5543,7 +5543,7 @@
> work very diligently to write out a history of the accident , all except the
# N🅪Sg/VB J/R R P NSg/VB NSg/VB/J/R/P D/P N🅪Sg P D NSg/J+ . NSg/I/J/C/Dq VB/C/P D
> Lizard , who seemed too much overcome to do anything but sit with its mouth open ,
# NSg . NPr/I+ VP/J R NSg/I/J/R/Dq NSg/VB P VXB NSg/I/VB+ NSg/C/P NSg/VB P ISg/D$+ NSg/VB+ NSg/VB/J .
# NSg . NPr/I+ VP/J R NSg/I/J/R/Dq VB P VXB NSg/I/VB+ NSg/C/P NSg/VB P ISg/D$+ NSg/VB+ NSg/VB/J .
> gazing up into the roof of the court .
# Nᴹ/Vg/J NSg/VB/J/P P D NSg/VB P D N🅪Sg/VB/J+ .
>

View File

@@ -919,7 +919,7 @@
> The sailors were infected with malaria .
# D+ NPl+ NSg/VPt NSg/VP/J P Nᴹ+ .
> overcome with happiness
# NSg/VB P Nᴹ+
# VB P Nᴹ+
> green with envy ; flushed with success
# NPr🅪Sg/VB/J P NSg/VB+ . VP/J P N🅪Sg+
> She was with Acme for twenty years before retiring last fall .