Skip to content

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

feat: bullocks→bollocks (#2970)

Andrew Dunbar6ebb9003a0dd
diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rs
index 8de44a71c..546c08c02 100644
--- a/harper-core/src/linting/phrase_set_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_set_corrections/mod.rs
@@ -61,6 +61,27 @@ pub fn lint_group() -> LintGroup {
"Corrects `adieu` to `ado`.",
LintKind::Eggcorn
),
+ "Bollocks" => (
+ &[
+ ("bullocks!", "bollocks!"),
+ ("complete bullocks", "complete bollocks"),
+ ("dogs bullocks", "dogs bollocks"),
+ ("dog's bullocks", "dog's bollocks"),
+ ("is bullocks", "is bollocks"),
+ ("it's bullocks", "it's bollocks"),
+ ("its bullocks", "its bollocks"),
+ ("such bullocks", "such bollocks"),
+ ("that's bullocks", "that's bollocks"),
+ ("thats bullocks", "thats bollocks"),
+ ("total bullocks", "total bollocks"),
+ ("utter bullocks", "utter bollocks"),
+ ("was bullocks", "was bollocks"),
+ ("what bullocks", "what bollocks"),
+ ],
+ "The slang word for `nonsense` is `bollocks`. `Bullocks` are male cattle.",
+ "Corrects `bullocks` to `bollocks` when the meaning is `nonsense`.",
+ LintKind::Spelling
+ ),
"ChampAtTheBit" => (
&[
("chomp at the bit", "champ at the bit"),
diff --git a/harper-core/src/linting/phrase_set_corrections/tests.rs b/harper-core/src/linting/phrase_set_corrections/tests.rs
index 88c8d9c2c..79784e7c6 100644
--- a/harper-core/src/linting/phrase_set_corrections/tests.rs
+++ b/harper-core/src/linting/phrase_set_corrections/tests.rs
@@ -26,6 +26,133 @@ fn corrects_much_ado() {
);
}
+// Bollocks
+
+#[test]
+fn fix_complete_bullocks() {
+ assert_suggestion_result(
+ "why you think some of them are complete bullocks or would be a bad idea",
+ lint_group(),
+ "why you think some of them are complete bollocks or would be a bad idea",
+ );
+}
+
+#[test]
+fn fix_dogs() {
+ assert_suggestion_result(
+ "The cat's ass, priceless! I have to steal that one. My go to phrase is “The dog's bullocks.",
+ lint_group(),
+ "The cat's ass, priceless! I have to steal that one. My go to phrase is “The dog's bollocks.",
+ );
+}
+
+#[test]
+fn fix_dogs_no_apostrophe_bullocks() {
+ assert_suggestion_result(
+ "some dumb rubbish that i do not give a dogs bullocks about",
+ lint_group(),
+ "some dumb rubbish that i do not give a dogs bollocks about",
+ );
+}
+
+#[test]
+fn fix_is_bullocks() {
+ assert_suggestion_result(
+ "for me this is bullocks, when the same user can sudo rm -rf",
+ lint_group(),
+ "for me this is bollocks, when the same user can sudo rm -rf",
+ );
+}
+
+#[test]
+fn fix_its_bullocks() {
+ assert_suggestion_result(
+ "I'm too lazy to explain why, but I think it's bullocks.",
+ lint_group(),
+ "I'm too lazy to explain why, but I think it's bollocks.",
+ );
+}
+
+#[test]
+fn fix_its_no_apostrophe_bullocks() {
+ assert_suggestion_result(
+ "but lance, dont claim to be clean, because we all know its bullocks",
+ lint_group(),
+ "but lance, dont claim to be clean, because we all know its bollocks",
+ );
+}
+
+#[test]
+fn fix_such_bullocks() {
+ assert_suggestion_result(
+ "This is why numerology is such bullocks.",
+ lint_group(),
+ "This is why numerology is such bollocks.",
+ );
+}
+
+#[test]
+fn fix_thats_bullocks() {
+ assert_suggestion_result(
+ "Respectfully, that's bullocks.",
+ lint_group(),
+ "Respectfully, that's bollocks.",
+ );
+}
+
+#[test]
+fn fix_thats_no_apostrophe_bullocks() {
+ assert_suggestion_result(
+ "In CSS thats bullocks as directives have priority in the order they are defined.",
+ lint_group(),
+ "In CSS thats bollocks as directives have priority in the order they are defined.",
+ );
+}
+
+#[test]
+fn fix_total_bullocks() {
+ assert_suggestion_result(
+ "Pointing out to the audience that their gravity explanation is total bullocks would seem an ethical must as well.",
+ lint_group(),
+ "Pointing out to the audience that their gravity explanation is total bollocks would seem an ethical must as well.",
+ );
+}
+
+#[test]
+fn fix_utter_bullocks() {
+ assert_suggestion_result(
+ "what utter bullocks a self employed person will get £94 under corona virus crisis",
+ lint_group(),
+ "what utter bollocks a self employed person will get £94 under corona virus crisis",
+ );
+}
+
+#[test]
+fn fix_was_bullocks() {
+ assert_suggestion_result(
+ "a few years ago I thought that was bullocks",
+ lint_group(),
+ "a few years ago I thought that was bollocks",
+ );
+}
+
+#[test]
+fn fix_bullocks_exclamation() {
+ assert_suggestion_result(
+ "throw(new Error('Bullocks!')));",
+ lint_group(),
+ "throw(new Error('Bollocks!')));",
+ );
+}
+
+#[test]
+fn dont_flag_herd_of_bullocks() {
+ assert_no_lints(
+ "driven back (literally) by a herd of bullocks across the path",
+ lint_group(),
+ );
+}
+
// ChampAtTheBit
#[test]
fn correct_chomp_at_the_bit() {