-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Various code quality improvements (#1540)
* Don't change working directory in `load_package_copy()`. Fixes #1539. * Use `local_roxy_meta_set()` everywhere possible. Fixes #1536. * Reconsider display of warnings. Fixes #1533.
- Loading branch information
Showing
49 changed files
with
664 additions
and
565 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,48 @@ | ||
# has thoughtful print method | ||
|
||
<roxy_block> [<text>:5] | ||
$tag | ||
[line: 1] @title 'This is a title' {parsed} | ||
[line: 3] @param 'x,y A number' {parsed} | ||
[line: 4] @export '' {parsed} | ||
[line: 5] @usage '<generated>' {parsed} | ||
[line: 5] @.formals '<generated>' {parsed} | ||
[line: 5] @backref '<generated>' {parsed} | ||
$call f <- function(x, y) x + y | ||
$object <function> | ||
$topic f | ||
$alias f | ||
Code | ||
parse_text(text)[[1]] | ||
Output | ||
<roxy_block> [<text>:5] | ||
$tag | ||
[line: 1] @title 'This is a title' {parsed} | ||
[line: 3] @param 'x,y A number' {parsed} | ||
[line: 4] @export '' {parsed} | ||
[line: 5] @usage '<generated>' {parsed} | ||
[line: 5] @.formals '<generated>' {parsed} | ||
[line: 5] @backref '<generated>' {parsed} | ||
$call f <- function(x, y) x + y | ||
$object <function> | ||
$topic f | ||
$alias f | ||
|
||
# errors are propagated | ||
|
||
[<text>:5] @eval failed to evaluate | ||
Caused by error in `foo()`: | ||
! Uhoh | ||
Code | ||
. <- roc_proc_text(rd_roclet(), block) | ||
Message | ||
x <text>:5: @eval failed to evaluate. | ||
Caused by error in `foo()`: | ||
! Uhoh | ||
|
||
# must return non-NA string | ||
|
||
[<text>:3] @eval must evaluate to a character vector | ||
Code | ||
. <- roc_proc_text(rd_roclet(), block) | ||
Message | ||
x <text>:3: @eval must evaluate to a character vector. | ||
|
||
--- | ||
|
||
[<text>:3] @eval must not contain any missing values | ||
Code | ||
. <- roc_proc_text(rd_roclet(), block) | ||
Message | ||
x <text>:3: @eval must not contain any missing values. | ||
|
||
# warns about duplicate tags | ||
|
||
[<text>:5] Block must contain only one @rdname | ||
Code | ||
. <- roc_proc_text(rd_roclet(), block) | ||
Message | ||
x <text>:5: Block must contain only one @rdname. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
# warning for both @md and @noMd | ||
|
||
[<text>:5] @md conflicts with @noMd; turning markdown parsing off | ||
Code | ||
out1 <- roc_proc_text(rd_roclet(), block) | ||
Message | ||
x <text>:5: @md conflicts with @noMd; turning markdown parsing off. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,94 @@ | ||
# @exportS3method generates fully automatically | ||
|
||
[<text>:2] @exportS3Method must be used with an known S3 method | ||
Code | ||
. <- roc_proc_text(namespace_roclet(), block) | ||
Message | ||
x <text>:2: @exportS3Method must be used with an known S3 method. | ||
|
||
# @exportS3method can extract class from generic | ||
|
||
[<text>:2] @exportS3Method must have form package::generic | ||
Code | ||
. <- roc_proc_text(namespace_roclet(), block) | ||
Message | ||
x <text>:2: @exportS3Method must have form package::generic. | ||
|
||
--- | ||
|
||
[<text>:2] @exportS3Method must be used with a function | ||
Code | ||
. <- roc_proc_text(namespace_roclet(), block) | ||
Message | ||
x <text>:2: @exportS3Method must be used with a function. | ||
|
||
--- | ||
|
||
[<text>:2] @exportS3Method doesn't match function name | ||
x Expected to see "foo" to match "pkg::foo" | ||
i Function name is "foo1.bar" | ||
Code | ||
. <- roc_proc_text(namespace_roclet(), block) | ||
Message | ||
x <text>:2: @exportS3Method doesn't match function name. | ||
x Expected to see "foo" to match "pkg::foo" | ||
i Function name is "foo1.bar" | ||
|
||
# poorly formed importFrom throws error | ||
|
||
[<text>:2] @importFrom must have at least 2 words, not 1 | ||
Code | ||
. <- roc_proc_text(namespace_roclet(), block) | ||
Message | ||
x <text>:2: @importFrom must have at least 2 words, not 1. | ||
|
||
# rawNamespace must be valid code | ||
|
||
[<text>:2] @rawNamespace failed to parse | ||
Caused by error in `parse()`: | ||
! <text>:2:0: unexpected end of input | ||
1: a + | ||
^ | ||
Code | ||
. <- roc_proc_text(namespace_roclet(), block) | ||
Message | ||
x <text>:2: @rawNamespace failed to parse. | ||
Caused by error in `parse()`: | ||
! <text>:2:0: unexpected end of input | ||
1: a + | ||
^ | ||
|
||
# evalNamespace warns for bad code | ||
|
||
[<text>:2] @evalNamespace failed to parse | ||
Caused by error in `parse()`: | ||
! <text>:2:0: unexpected end of input | ||
1: a + | ||
^ | ||
Code | ||
. <- roc_proc_text(namespace_roclet(), block) | ||
Message | ||
x <text>:2: @evalNamespace failed to parse. | ||
Caused by error in `parse()`: | ||
! <text>:2:0: unexpected end of input | ||
1: a + | ||
^ | ||
|
||
--- | ||
|
||
[<text>:2] @evalNamespace failed to evaluate | ||
Caused by error: | ||
! Uhoh | ||
Code | ||
. <- roc_proc_text(namespace_roclet(), block) | ||
Message | ||
x <text>:2: @evalNamespace failed to evaluate. | ||
Caused by error: | ||
! Uhoh | ||
|
||
--- | ||
|
||
[<text>:2] @evalNamespace must evaluate to a character vector | ||
Code | ||
. <- roc_proc_text(namespace_roclet(), block) | ||
Message | ||
x <text>:2: @evalNamespace must evaluate to a character vector. | ||
|
||
# Invalid imports throw a helpful error | ||
|
||
Code | ||
out <- roc_proc_text(namespace_roclet(), block) | ||
Message | ||
x <text>:2: @importFrom Excluding unknown export in from utils: `InvalidUtilsFunction`. | ||
|
||
--- | ||
|
||
Code | ||
out <- roc_proc_text(namespace_roclet(), block) | ||
Message | ||
x <text>:2: @importFrom Excluding unknown exports in from utils: `InvalidUtilsFunction1` and `InvalidUtilsFunction2`. | ||
|
||
--- | ||
|
||
Code | ||
out <- roc_proc_text(namespace_roclet(), block) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.