Skip to content

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

feat: dir → directory (#3470)

Andrew Dunbarc6e194791df5
diff --git a/harper-core/default_config.json b/harper-core/default_config.json
index e61685bad..67a141d93 100644
--- a/harper-core/default_config.json
+++ b/harper-core/default_config.json
@@ -1317,6 +1317,13 @@
"label": "Expand Coordinate"
}
},
+ {
+ "Bool": {
+ "name": "ExpandDirectory",
+ "state": true,
+ "label": "Expand Directory"
+ }
+ },
{
"Bool": {
"name": "ExpandNotification",
diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rs
index 8808081ea..aab872ef9 100644
--- a/harper-core/src/linting/phrase_set_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_set_corrections/mod.rs
@@ -232,6 +232,15 @@ pub fn lint_group() -> LintGroup {
"Expands the abbreviation `deref` to the full word `dereference` for clarity.",
LintKind::Style
),
+ "ExpandDirectory" => (
+ &[
+ ("dir", "directory"),
+ ("dirs", "directories")
+ ],
+ "Use `directory` instead of `dir`",
+ "Expands the abbreviation `dir` to the full word `directory` for clarity.",
+ LintKind::Style
+ ),
"ExpandNotification" => (
&[
("notif", "notification"),
diff --git a/harper-core/src/linting/phrase_set_corrections/tests.rs b/harper-core/src/linting/phrase_set_corrections/tests.rs
index a58abc312..ad2b307fc 100644
--- a/harper-core/src/linting/phrase_set_corrections/tests.rs
+++ b/harper-core/src/linting/phrase_set_corrections/tests.rs
@@ -754,6 +754,26 @@ fn corrects_derefs() {
);
}
+// ExpandDirectory
+
+#[test]
+fn expands_dir() {
+ assert_suggestion_result(
+ "Error: library dir does not exist: /Users/u/trr/node_modules/opencv",
+ lint_group(),
+ "Error: library directory does not exist: /Users/u/trr/node_modules/opencv",
+ );
+}
+
+#[test]
+fn expands_dirs() {
+ assert_suggestion_result(
+ "Dirs/files are missing when scanning on windows after 1.27.12",
+ lint_group(),
+ "Directories/files are missing when scanning on windows after 1.27.12",
+ );
+}
+
// ExpandNotification
#[test]