Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
Merge branch 'master' into new-rules
Elijah Potter79ca342e774c
diff --cc harper-core/affixes.jsonindex b7064cf0e,ad3051ca6..aefdc2d8f--- a/harper-core/affixes.json+++ b/harper-core/affixes.json@@@ -676,24 -723,10 +723,24 @@@"kind": "property","cross_product": true,"replacements": [],- "target_metadata": {},+ "target": [],"base_metadata": {"pronoun": {- "is_plural": false+ "is_plural": false,+ "person": "First"+ }+ }+ },+ "w": {+ "#": "first-person plural property",+ "kind": "property",+ "cross_product": true,+ "replacements": [],+ "target_metadata": {},+ "base_metadata": {+ "pronoun": {+ "is_plural": true,+ "person": "First"}}},@@@ -702,11 -735,9 +749,11 @@@"kind": "property","cross_product": true,"replacements": [],- "target_metadata": {},+ "target": [],"base_metadata": {- "pronoun": {}+ "pronoun": {+ "person": "Second"+ }}},"t": {diff --cc harper-core/src/linting/lint_group.rsindex 5470ed84b,3ec32adcc..265c5ee71--- a/harper-core/src/linting/lint_group.rs+++ b/harper-core/src/linting/lint_group.rs@@@ -76,11 -70,11 +76,12 @@@ use super::use_genitive::UseGenitiveuse super::was_aloud::WasAloud;use super::whereas::Whereas;use super::widely_accepted::WidelyAccepted;+use super::win_prize::WinPrize;use super::wordpress_dotcom::WordPressDotcom;- use super::{CurrencyPlacement, Linter, NoOxfordComma, OxfordComma};+ use super::{CurrencyPlacement, HtmlDescriptionLinter, Linter, NoOxfordComma, OxfordComma};use super::{Lint, PatternLinter};use crate::linting::dashes::Dashes;+ use crate::linting::open_compounds::OpenCompounds;use crate::linting::{closed_compounds, phrase_corrections};use crate::{CharString, Dialect, Document, TokenStringExt};use crate::{Dictionary, MutableDictionary};diff --cc harper-core/src/linting/mod.rsindex bdd079303,d3ac8d24a..d661b75aa--- a/harper-core/src/linting/mod.rs+++ b/harper-core/src/linting/mod.rs@@@ -153,10 -143,9 +154,10 @@@ pub use use_genitive::UseGenitivepub use was_aloud::WasAloud;pub use whereas::Whereas;pub use widely_accepted::WidelyAccepted;+pub use win_prize::WinPrize;pub use wordpress_dotcom::WordPressDotcom;- use crate::{Document, LSend};+ use crate::{Document, LSend, render_markdown};/// A __stateless__ rule that searches documents for grammatical errors.///diff --cc harper-core/src/linting/phrase_corrections.rsindex e88611123,9057a7ad3..9fd19fa6c--- a/harper-core/src/linting/phrase_corrections.rs+++ b/harper-core/src/linting/phrase_corrections.rs@@@ -1213,12 -1201,18 +1201,24 @@@ pub fn lint_group() -> LintGroup"The period of economic prosperity is called the `Gilded Age`.","If referring to the period of economic prosperity, the correct term is `Gilded Age`."),+ "EverPresent" => (+ ["ever present"],+ ["ever-present"],+ "Hyphenate `ever-present` when it functions as a compound adjective.",+ "Corrects the missing hyphen in `ever present` to the compound adjective `ever-present`."+ ),+ "DefiniteArticle" => (+ ["definitive article"],+ ["definite article"],+ "The correct term for `the` is `definite article`.",+ "The name of the word `the` is `definite article`."+ ),+ "DefiniteArticles" => (+ ["definitive articles"],+ ["definite articles"],+ "The correct term for `the` is `definite article`.",+ "The name of the word `the` is `definite article`."+ )});group.set_all_rules_to(Some(true));@@@ -2687,17 -2602,31 +2608,45 @@@ mod tests);}+ #[test]+ fn detect_ever_present_atomic() {+ assert_suggestion_result("ever present", lint_group(), "ever-present");+ }++ #[test]+ fn detect_ever_present_real_world() {+ assert_suggestion_result(+ "Distrust was an ever present tension in the negotiations.",+ lint_group(),+ "Distrust was an ever-present tension in the negotiations.",+ );+ }+++ #[test]+ fn corrects_definite_article() {+ assert_suggestion_result(+ "As for format of outputs: the spec defines the field as using the singular definitive article \"the\"",+ lint_group(),+ "As for format of outputs: the spec defines the field as using the singular definite article \"the\"",+ );+ }++ #[test]+ #[ignore = "Title case capitalization problem causes this one to fail too."]+ fn corrects_definite_articles_title_case() {+ assert_suggestion_result(+ "01 Definitive Articles: De or Het. Before starting more complicated topics in Dutch grammar, you should be aware of the articles.",+ lint_group(),+ "01 Definite Articles: De or Het. Before starting more complicated topics in Dutch grammar, you should be aware of the articles.",+ );+ }++ #[test]+ fn corrects_definite_articles_lowercase() {+ assert_suggestion_result(+ ".. definitive articles -та /-ta/ and -те /-te/ (postfixed in Bulgarian).",+ lint_group(),+ ".. definite articles -та /-ta/ and -те /-te/ (postfixed in Bulgarian).",+ );+ }}diff --cc harper-core/tests/text/tagged/Computer science.mdindex 876fcfae8,23e1cb04d..6ff7ff6c7--- a/harper-core/tests/text/tagged/Computer science.md+++ b/harper-core/tests/text/tagged/Computer science.md@@@ -219,11 -219,11 +219,11 @@@> universities went on to create such departments , starting with Purdue in 1962 .# NPl NSg/V J/P P V/J NSg/I NPl . V P NPr P # .> Despite its name , a significant amount of computer science does not involve the-# NSg/V/P ISg/D NSg . D/P NSg/J NSg/V P NSg/V NSg/V NSg/V NSg/C V D+# NSg/V/P ISg/D NSg . D/P NSg/J NSg/V P NSg/V NSg/V NPl/V NSg/C V D> study of computers themselves . Because of this , several alternative names have- # NSg P NPl I . C/P P I/D . J/D NSg/J NPl NSg/VX+ # NSg P NPl/V I . C/P P I/D . J/D NSg/J NPl/V NSg/VX> been proposed . Certain departments of major universities prefer the term- # NSg/V W? . I/J NPl P NPrSg/V/J NPl V D NSg/J+ # NSg/V V/J . I/J NPl P NPrSg/V/J NPl V D NSg/J> computing science , to emphasize precisely that difference . Danish scientist# NSg/V NSg/V . P V J/R N/I/C/D NSg/V . NPrSg/J NSg> Peter Naur suggested the term datalogy , to reflect the fact that the scientific@@@ -709,9 -709,9 +709,9 @@@> fast to build . It is a systematic approach to software design , involving the# NSg/V/J P NSg/V . NPrSg/ISg VL D/P J NSg/V P NSg NSg/V . V D> application of engineering practices to software . Software engineering deals- # NSg P NSg/V NPl P NSg . NSg NSg/V NPl+ # NSg P NSg/V NPl/V P NSg . NSg NSg/V NPl/V> with the organizing and analyzing of software — it does not just deal with the-# P D N/J V/C V P NSg . NPrSg/ISg NSg/V NSg/C V/J NSg/V/J P D+# P D N/J V/C V P NSg . NPrSg/ISg NPl/V NSg/C V/J NSg/V/J P D> creation or manufacture of new software , but its internal arrangement and# NSg NPrSg/C NSg/V P NSg/V/J NSg . NSg/C/P ISg/D J NSg V/C> maintenance . For example software testing , systems engineering , technical debt