Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

feat: mixing up "altar" and "alter" (#4669)

Andrew Dunbarf34714f058da
diff --git a/harper-core/default_config.json b/harper-core/default_config.json
index f0b10eb1a..b732f0a7b 100644
--- a/harper-core/default_config.json
+++ b/harper-core/default_config.json
@@ -4345,6 +4345,13 @@
"label": "Alongside"
}
},
+ {
+ "Bool": {
+ "name": "AltarAlter",
+ "state": true,
+ "label": "Altar / Alter"
+ }
+ },
{
"Bool": {
"name": "AlzheimersDisease",
diff --git a/harper-core/src/linting/weir_rules/AltarAlter/ToAltar.weir b/harper-core/src/linting/weir_rules/AltarAlter/ToAltar.weir
new file mode 100644
index 000000000..6cab1b24c
--- /dev/null
+++ b/harper-core/src/linting/weir_rules/AltarAlter/ToAltar.weir
@@ -0,0 +1,10 @@
+expr prev [great, high, main]
+expr next [boy, boys]
+expr main [<(@prev alter), alter>, <(alter @next), alter>]
+
+let message "Did you mean the noun `altar`?"
+let description "Looks for mixing up the noun `altar` with the verb `alter`."
+let kind "WordChoice"
+let becomes "altar"
+
+test "When I was that age I was a devoted alter boy with ideas of eventually becoming a priest." "When I was that age I was a devoted altar boy with ideas of eventually becoming a priest."
diff --git a/harper-core/src/linting/weir_rules/AltarAlter/ToAlter.weir b/harper-core/src/linting/weir_rules/AltarAlter/ToAlter.weir
new file mode 100644
index 000000000..9729fe41f
--- /dev/null
+++ b/harper-core/src/linting/weir_rules/AltarAlter/ToAlter.weir
@@ -0,0 +1,19 @@
+expr modal [can, cannot, can't, could, couldn't, may, might, mightn't, must, mustn't, shall, shan't, shouldn't, will, won't, would, wouldn't]
+expr prev [not]
+expr next [DET, database, ego, index]
+expr main [<(@modal altar), altar>, <(@prev altar), altar>, <(altar @next), altar>]
+
+let message "Did you mean the verb `alter`?"
+let description "Looks for mixing up the noun `altar` with the verb `alter`."
+let kind "WordChoice"
+let becomes "alter"
+
+# modal verb + altar
+test "You can altar the lang file for name changes." "You can alter the lang file for name changes."
+
+# ideally, we'd flag 'to altar'
+# test "I uploaded a blueprint to the workshop and was attempting to altar the main pic used but wasn't able to." "I uploaded a blueprint to the workshop and was attempting to alter the main pic used but wasn't able to."
+# test "which will open a form allowing them to altar that entry's content" "which will open a form allowing them to alter that entry's content"
+
+# why we can't flag 'altar it'
+allows "When right clicking the altar it successfully initiates the crafting process"