Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat: deference → dereference (#4607)
Andrew Dunbar9ba41696784f
diff --git a/harper-core/default_config.json b/harper-core/default_config.jsonindex fd7de1304..86c69dcc5 100644--- a/harper-core/default_config.json+++ b/harper-core/default_config.json@@ -2616,6 +2616,13 @@"label": "Close Tight Knit"}},+ {+ "Bool": {+ "name": "Dereference",+ "state": true,+ "label": "Dereference"+ }+ },{"Bool": {"name": "DoNotWant",diff --git a/harper-core/src/linting/weir_rules/Dereference/ContextAfter.weir b/harper-core/src/linting/weir_rules/Dereference/ContextAfter.weirnew file mode 100644index 000000000..1cfc08a59--- /dev/null+++ b/harper-core/src/linting/weir_rules/Dereference/ContextAfter.weir@@ -0,0 +1,9 @@+expr main <(deference [operation, operator, pointer]), deference>+let message "Did you mean `dereference`?"+let description "Corrects `deference` to `dereference`."+let kind "Typo"+let becomes "dereference"++test "as efficient as one pointer arithmetic and deference operation" "as efficient as one pointer arithmetic and dereference operation"+test "Value-at or Deference operator is used to access the variable to which a pointer is pointing." "Value-at or Dereference operator is used to access the variable to which a pointer is pointing."+test "Fix to RC2 to not deference pointer before ARGCHK" "Fix to RC2 to not dereference pointer before ARGCHK"diff --git a/harper-core/src/linting/weir_rules/Dereference/ContextBefore.weir b/harper-core/src/linting/weir_rules/Dereference/ContextBefore.weirnew file mode 100644index 000000000..111020c2b--- /dev/null+++ b/harper-core/src/linting/weir_rules/Dereference/ContextBefore.weir@@ -0,0 +1,7 @@+expr main <([pointer] deference), deference>+let message "Did you mean `dereference`?"+let description "Corrects `deference` to `dereference`."+let kind "Typo"+let becomes "dereference"++test "How about if the compiler translates a pointer deference into a read of that memory address?" "How about if the compiler translates a pointer dereference into a read of that memory address?"