Skip to content

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

feat: govt → government (#3212)

Andrew Dunbar17fe91f0d866
diff --git a/harper-core/default_config.json b/harper-core/default_config.json
index 8dae41468..629ae74d5 100644
--- a/harper-core/default_config.json
+++ b/harper-core/default_config.json
@@ -1260,6 +1260,13 @@
"state": true,
"label": "Worse Or Worst"
}
+ },
+ {
+ "Bool": {
+ "name": "ExpandGovt",
+ "state": true,
+ "label": "Expand Govt"
+ }
}
]
}
diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rs
index 59f4e91d5..b7973c674 100644
--- a/harper-core/src/linting/phrase_set_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_set_corrections/mod.rs
@@ -730,6 +730,15 @@ pub fn lint_group() -> LintGroup {
"Expands the abbreviation `decl` to the full word `declaration` or `declarator` for clarity.",
LintKind::Style
),
+ "ExpandGovt" => (
+ &[
+ (&["govt", "govt."], &["government"]),
+ (&["govts"], &["governments"])
+ ],
+ "Use `government` instead of `govt` or `govt.`",
+ "Expands the abbreviation `govt` or `govt.` to the full word `government` for clarity.",
+ LintKind::Style
+ ),
"Expat" => (
&[
(&["ex-pat", "ex pat"], &["expat"]),
diff --git a/harper-core/src/linting/phrase_set_corrections/tests.rs b/harper-core/src/linting/phrase_set_corrections/tests.rs
index 69bc598de..4a812106a 100644
--- a/harper-core/src/linting/phrase_set_corrections/tests.rs
+++ b/harper-core/src/linting/phrase_set_corrections/tests.rs
@@ -2326,6 +2326,35 @@ fn expand_alloc() {
);
}
+// ExpandGovt
+
+#[test]
+fn corrects_govt_no_dot() {
+ assert_suggestion_result(
+ "Separation between privately issued credentials vs govt issued identity credentials",
+ lint_group(),
+ "Separation between privately issued credentials vs government issued identity credentials",
+ );
+}
+
+#[test]
+fn corrects_govt_do() {
+ assert_suggestion_result(
+ "Demystifying public comments on govt. regulations.",
+ lint_group(),
+ "Demystifying public comments on government regulations.",
+ );
+}
+
+#[test]
+fn corrects_govts() {
+ assert_suggestion_result(
+ "Those 'elite' economists have been advising govts for years.",
+ lint_group(),
+ "Those 'elite' economists have been advising governments for years.",
+ );
+}
+
// Expat
#[test]