Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat: flag "agree" used after "am", "is" or "are" (#4831)
mcampal3b6e788886fb
diff --git a/harper-core/default_config.json b/harper-core/default_config.jsonindex 39a06aa54..bd6e3edec 100644--- a/harper-core/default_config.json+++ b/harper-core/default_config.json@@ -3678,6 +3678,13 @@"state": true}},+ {+ "Bool": {+ "name": "BeAgree",+ "state": true,+ "label": "Be Agree"+ }+ },{"Bool": {"name": "Beforehand",diff --git a/harper-core/src/linting/weir_rules/BeAgree/Am.weir b/harper-core/src/linting/weir_rules/BeAgree/Am.weirnew file mode 100644index 000000000..e6b9fe931--- /dev/null+++ b/harper-core/src/linting/weir_rules/BeAgree/Am.weir@@ -0,0 +1,32 @@+expr main <(I am agree), (am agree)>++let message "`agree` is a verb, so it doesn't need `am`: `I agree`."+let description "Corrects `I am agree` to `I agree`."+let kind "Grammar"+let becomes "agree"+let strategy "MatchCase"++# real sentences from Hacker News and GitHub issues+test "I am agree that JSONP is a bad workaround, but it is not an option to do nothing." "I agree that JSONP is a bad workaround, but it is not an option to do nothing."+test "I am agree, that wasm will be on par with generated/minified JS right now, but I predict that wasm will beat JS in future versions." "I agree, that wasm will be on par with generated/minified JS right now, but I predict that wasm will beat JS in future versions."+# made-up sentences+test "I am agree with you." "I agree with you."+test "Yes, I am agree." "Yes, I agree."+test "I am agree with the plan, but not the timeline." "I agree with the plan, but not the timeline."+test "Honestly, I am agree on this one." "Honestly, I agree on this one."+test "I AM AGREE." "I AGREE."+test "So I am agree that we should wait." "So I agree that we should wait."++# correct text+allows "I agree with you."+allows "I am in agreement with you."+allows "I am sure you agree."+allows "I agreed with the plan."+# real look-alikes that must not be flagged+allows "My reasoning was a bus can transport many more people than one bike, but sure, I am agreeable to switching 2 and 3."+# made-up look-alikes+allows "I am agreeable to that."+allows "I am, agree or not, staying."+allows "What I am agreeing to is the scope."+allows "I am not sure I agree."+allows "The terms I am asked to agree to are long."diff --git a/harper-core/src/linting/weir_rules/BeAgree/Are.weir b/harper-core/src/linting/weir_rules/BeAgree/Are.weirnew file mode 100644index 000000000..348a348b5--- /dev/null+++ b/harper-core/src/linting/weir_rules/BeAgree/Are.weir@@ -0,0 +1,34 @@+expr main <([we, you, they] are agree), (are agree)>++let message "`agree` is a verb, so it doesn't need `are`: `we agree`."+let description "Corrects `we are agree` to `we agree`."+let kind "Grammar"+let becomes "agree"+let strategy "MatchCase"++# real sentences from Hacker News and GitHub issues+test "But you are agree cron is pretty good so it seems analogy with flying brick does not work here." "But you agree cron is pretty good so it seems analogy with flying brick does not work here."+test "I only would consider people worthy to discuss if they are agree on this." "I only would consider people worthy to discuss if they agree on this."+# made-up sentences+test "We are agree with the plan." "We agree with the plan."+test "They are agree." "They agree."+test "I think you are agree with me." "I think you agree with me."+test "If we are agree, let's ship it." "If we agree, let's ship it."+test "WE ARE AGREE." "WE AGREE."+test "So they are agree on the scope?" "So they agree on the scope?"++# correct text+allows "We agree with the plan."+allows "We are in agreement."+allows "Do you agree?"+allows "They agreed on the scope."+# real look-alikes that must not be flagged+allows "Locking without a timeout is indeed in the majority of use-cases a non-starter, we are agreed there."+allows "We are agreed on that."+allows "If we are agreed this is a good idea we should do it asap to start benefiting from the simpler landscape this leaves us in."+# made-up look-alikes+allows "We are agreed on the scope."+allows "They are agreeable."+allows "Are you agreeing to this?"+allows "We are, agree or not, shipping it."+allows "These are the terms we are asked to agree to."diff --git a/harper-core/src/linting/weir_rules/BeAgree/Im.weir b/harper-core/src/linting/weir_rules/BeAgree/Im.weirnew file mode 100644index 000000000..b6a434a1d--- /dev/null+++ b/harper-core/src/linting/weir_rules/BeAgree/Im.weir@@ -0,0 +1,30 @@+expr main (I'm agree)++let message "`agree` is a verb, so it doesn't need `am`: `I agree`."+let description "Corrects `I'm agree` to `I agree`."+let kind "Grammar"+let becomes "I agree"+let strategy "MatchCase"++# real sentences from Hacker News and GitHub issues+test "C++ templates are ugly, I'm agree, but they are useful and heavily used." "C++ templates are ugly, I agree, but they are useful and heavily used."+test "As CS teacher I'm agree with others that JS is terrible choice as first language." "As CS teacher I agree with others that JS is terrible choice as first language."+# made-up sentences+test "I'm agree with you." "I agree with you."+test "Yes, I'm agree." "Yes, I agree."+test "I'm agree with the plan, but not the timeline." "I agree with the plan, but not the timeline."+test "Honestly, I'm agree on this one." "Honestly, I agree on this one."+test "I'M AGREE." "I AGREE."+test "So I'm agree that we should wait." "So I agree that we should wait."++# correct text+allows "I agree with you."+allows "I'm in agreement with you."+allows "I'm sure you agree."+allows "I agreed with the plan."+# look-alikes that must not be flagged+allows "I'm agreeable to that."+allows "I'm, agree or not, staying."+allows "What I'm agreeing to is the scope."+allows "I'm not sure I agree."+allows "The terms I'm asked to agree to are long."diff --git a/harper-core/src/linting/weir_rules/BeAgree/Is.weir b/harper-core/src/linting/weir_rules/BeAgree/Is.weirnew file mode 100644index 000000000..1c3b5403e--- /dev/null+++ b/harper-core/src/linting/weir_rules/BeAgree/Is.weir@@ -0,0 +1,30 @@+expr main <([he, she, everyone, everybody] is agree), (is agree)>++let message "`agree` is a verb, so it doesn't need `is`: `she agrees`."+let description "Corrects `she is agree` to `she agrees`."+let kind "Grammar"+let becomes "agrees"+let strategy "MatchCase"++# real sentences from Hacker News and GitHub issues+test "Not everyone is agree with that." "Not everyone agrees with that."+test "But he is agree that it is confusing to a user." "But he agrees that it is confusing to a user."+# made-up sentences+test "She is agree with the plan." "She agrees with the plan."+test "He is agree." "He agrees."+test "I think everyone is agree on this." "I think everyone agrees on this."+test "If everybody is agree, we can start." "If everybody agrees, we can start."+test "SHE IS AGREE." "SHE AGREES."+test "So he is agree with the change?" "So he agrees with the change?"++# correct text+allows "She agrees with the plan."+allows "She is in agreement."+allows "Does he agree?"+allows "Everyone agreed on this."+# look-alikes that must not be flagged+allows "Everyone is agreed on this."+allows "He is agreeable."+allows "Is she agreeing to this?"+allows "She is, agree or not, leaving."+allows "This is the deal everyone is asked to agree to."