mirror of
https://github.com/Automattic/harper.git
synced 2025-12-05 19:26:55 -06:00
fix(core): fix problems with the NeedToNoun rule (#2287)
This commit is contained in:
@@ -36986,7 +36986,7 @@ overcharge/VdGSNg
|
||||
overclock/VGdSN
|
||||
overcloud/VSGd
|
||||
overcoat/NgSV
|
||||
overcome/~VGSN
|
||||
overcome/~VGS
|
||||
overcompensate/VdSGn
|
||||
overcompensation/Nmg
|
||||
overconfidence/Nmg
|
||||
|
||||
@@ -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(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
1
harper-core/tests/test_sources/issue_2240.md
Normal file
1
harper-core/tests/test_sources/issue_2240.md
Normal file
@@ -0,0 +1 @@
|
||||
There is no more need to run `git`.
|
||||
@@ -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+ .
|
||||
>
|
||||
|
||||
@@ -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 .
|
||||
|
||||
Reference in New Issue
Block a user