Skip to content

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

feat: mixing up "of" and "off" (after quantifiers) (#4754)

Andrew Dunbare79c96ae25a9
diff --git a/harper-core/default_config.json b/harper-core/default_config.json
index 1b5ca0b75..78a1e6c72 100644
--- a/harper-core/default_config.json
+++ b/harper-core/default_config.json
@@ -5787,6 +5787,13 @@
"label": "Off Limits"
}
},
+ {
+ "Bool": {
+ "name": "OfOff",
+ "state": true,
+ "label": "Of / Off"
+ }
+ },
{
"Bool": {
"name": "OldestInTheBook",
diff --git a/harper-core/src/linting/weir_rules/OfOff.weir b/harper-core/src/linting/weir_rules/OfOff.weir
new file mode 100644
index 000000000..659ecd687
--- /dev/null
+++ b/harper-core/src/linting/weir_rules/OfOff.weir
@@ -0,0 +1,19 @@
+expr quantNum [bazillions, billions, dozens, gazillions, hundreds, millions, tens, trillions, zillions]
+expr quantDet [all, any, couple, few, many, much, several, some]
+
+expr main <([@quantNum, @quantDet] off [them, these, those]), off>
+
+let message "Is `off` here a typo for `of`?"
+let description "Looks for instances of `off` that might be typos for `of`."
+let kind "Typo"
+let becomes "of"
+
+# real-world examples
+
+test "All off them are more precise, reliable and even cheaper" "All of them are more precise, reliable and even cheaper"
+test "there are usually threshold of acceptable performance in all off those cases" "there are usually threshold of acceptable performance in all of those cases"
+test "Do all clients requests, some off them or none at all?" "Do all clients requests, some of them or none at all?"
+
+# real-word false positives
+
+allows "And, to top it all off, those ads were utterly ineffective"