Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions harper-core/src/linting/phrase_corrections/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,13 @@ pub fn lint_group() -> LintGroup {
"Expands the informal abbreviation `cuz` to the full word `because` for formality.",
LintKind::Style
),
"ExpandForward" => (
["fwd"],
["forward"],
"Use `forward` instead of `fwd`",
"Expands the abbreviation `fwd` to the full word `forward` for clarity.",
LintKind::Style
),
"ExpandMinimum" => (
["min"],
["minimum"],
Expand Down
10 changes: 10 additions & 0 deletions harper-core/src/linting/phrase_corrections/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,16 @@ fn expand_cuz() {
);
}

// ExpandForward
#[test]
fn expand_fwd() {
assert_suggestion_result(
"Now I look fwd to the interior, the color, etc.",
lint_group(),
"Now I look forward to the interior, the color, etc.",
);
}

// ExpandMinimum
// -none

Expand Down
20 changes: 19 additions & 1 deletion harper-core/src/linting/phrase_set_corrections/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,22 @@ pub fn lint_group() -> LintGroup {
),
"ExpandDependencies" => (
&[
("deps", "dependencies"),
("dep", "dependency"),
("deps", "dependencies"),
],
"Use `dependencies` instead of `deps`",
"Expands the abbreviation `deps` to the full word `dependencies` for clarity.",
LintKind::Style
),
"ExpandParameter" => (
&[
("param", "parameter"),
("params", "parameters"),
],
"Use `parameter` instead of `param`",
"Expands the abbreviation `param` to the full word `parameter` for clarity.",
LintKind::Style
),
"ExpandStandardInputAndOutput" => (
&[
("stdin", "standard input"),
Expand Down Expand Up @@ -363,6 +372,15 @@ pub fn lint_group() -> LintGroup {
"Corrects `copywrite` to `copyright`. `Copywrite` refers to writing copy, while `copyright` is the legal right to creative works.",
LintKind::WordChoice
),
"ExpandDecl" => (
&[
(&["decl"], &["declaration", "declarator"]),
(&["decls"], &["declarations", "declarators"])
],
"Use `declaration` or `declarator` instead of `decl`",
"Expands the abbreviation `decl` to the full word `declaration` or `declarator` for clarity.",
LintKind::Style
),
"Expat" => (
&[
(&["ex-pat", "ex pat"], &["expat"]),
Expand Down
62 changes: 62 additions & 0 deletions harper-core/src/linting/phrase_set_corrections/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,71 @@ fn corrects_why_dose() {

// Note: no false positive detected for 'why does'. Only true positives.

// ExpandArgument

#[test]
fn corrects_arg() {
assert_suggestion_result(
"but I cannot figure out how to flag an arg as required",
lint_group(),
"but I cannot figure out how to flag an argument as required",
);
}

#[test]
fn corrects_args() {
assert_suggestion_result(
"but every test I've done shows args as being about 65% faster",
lint_group(),
"but every test I've done shows arguments as being about 65% faster",
);
}

// ExpandDecl

#[test]
fn corrects_decl() {
assert_suggestion_result(
"Yeah, I agree a forward decl would be preferable in this case.",
lint_group(),
"Yeah, I agree a forward declaration would be preferable in this case.",
);
}

#[test]
fn corrects_decls() {
assert_suggestion_result(
"Accessing type decls from pointer types",
lint_group(),
"Accessing type declarations from pointer types",
);
}

// ExpandDependency
// -none-

// ExpandParam

#[test]
fn corrects_param() {
assert_suggestion_result(
"If I use the following to set an endDate param with a default value",
lint_group(),
"If I use the following to set an endDate parameter with a default value",
);
}

#[test]
fn corrects_params() {
assert_suggestion_result(
"the params are not loaded in the R environment when using the terminal",
lint_group(),
"the parameters are not loaded in the R environment when using the terminal.",
);
}

// ExpandSpecification

// ExpandStandardInput
// -none-

Expand Down
Loading