Skip to content

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

chore: improve message and description for `SomewhatSomething` (#1931)

Andrew Dunbarcfc32af5cce8
diff --git a/harper-core/src/linting/somewhat_something.rs b/harper-core/src/linting/somewhat_something.rs
index d518cb1c8..879827bb5 100644
--- a/harper-core/src/linting/somewhat_something.rs
+++ b/harper-core/src/linting/somewhat_something.rs
@@ -1,6 +1,5 @@
use crate::Token;
-use crate::expr::Expr;
-use crate::expr::SequenceExpr;
+use crate::expr::{Expr, SequenceExpr};
use super::{ExprLinter, Lint, LintKind, Suggestion};
@@ -35,13 +34,13 @@ impl ExprLinter for SomewhatSomething {
span,
lint_kind: LintKind::Style,
suggestions: vec![Suggestion::replace_with_match_case_str("something", og)],
- message: "Use the traditional form.".to_owned(),
+ message: "Consider using `something of a` in more formal writing.".to_owned(),
priority: 63,
})
}
fn description(&self) -> &'static str {
- "When describing a single instance of a noun, use `something` rather than `somewhat`."
+ "Flags the phrase `somewhat of a` in favor of `something of a`, which can be considered more traditional."
}
}
@@ -59,4 +58,13 @@ mod tests {
"This may be something of a surprise.",
);
}
+
+ #[test]
+ fn flag_these() {
+ assert_suggestion_result(
+ "These are somewhat of a cult data structure.",
+ SomewhatSomething::default(),
+ "These are something of a cult data structure.",
+ );
+ }
}