-
Notifications
You must be signed in to change notification settings - Fork 186
add name attribute to Linter class #753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
make expect_lint() resilient to complete removal of the argument
R/function_left_parentheses.R
Outdated
@@ -7,7 +7,7 @@ function_left_parentheses_linter <- function() { # nolint: object_length_linter. | |||
ids_with_token(source_file, "'('"), | |||
function(id) { | |||
|
|||
parsed <- source_file$parsed_content[id, ] | |||
parsed <- source_file$parsed_content[id,] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the lint is correct, isn't it?
R/utils.R
Outdated
@@ -62,13 +62,30 @@ names2 <- function(x) { | |||
names(x) %||% rep("", length(x)) | |||
} | |||
|
|||
linter_auto_name <- function(which = -3L) { | |||
call <- sys.call(which = which) | |||
nm <- paste(deparse(call, 500L), collapse = "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collapse
should be " "
IINM
R/utils.R
Outdated
if (inherits(x, "linter")) { | ||
attr(x, "name", exact = TRUE) | ||
} else { | ||
paste(deparse(x, 500L), collapse = "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
tests/testthat/test-methods.R
Outdated
"lint" | ||
) | ||
|
||
expect_warning( | ||
Lint("dummy.R", linter = "deprecated"), | ||
fixed = "deprecated" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't fixed
the argument passed to grepl
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, the warning should contain the text "deprecated", no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then fixed=TRUE and I think warning="deprecated" if you want to name it right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, thanks for pointing that out.
We have a lot of these calls in test-lint_file.R
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically looks good, small changes
fix test expectation
* add name attribute to Linter class fixes #746 * fix test failures * document() * restore 100% coverage for utils.R * deprecate Lint(linter = ...) and remove all calling instances make expect_lint() resilient to complete removal of the argument * add NEWS bullet * document() * fix lint, collapse with space fix test expectation Co-authored-by: Michael Chirico <michaelchirico4@gmail.com>
* add name attribute to Linter class fixes #746 * fix test failures * document() * restore 100% coverage for utils.R * deprecate Lint(linter = ...) and remove all calling instances make expect_lint() resilient to complete removal of the argument * add NEWS bullet * document() * fix lint, collapse with space fix test expectation Co-authored-by: Michael Chirico <michaelchirico4@gmail.com>
* initial formalization of Russ's branch comparison script * tweaks * tweak again * debugging * workaround for Depends * more tweak * skip empty depends * add to buildignore * use optparse * consolidate TODO * add name attribute to Linter class (#753) * add name attribute to Linter class fixes #746 * fix test failures * document() * restore 100% coverage for utils.R * deprecate Lint(linter = ...) and remove all calling instances make expect_lint() resilient to complete removal of the argument * add NEWS bullet * document() * fix lint, collapse with space fix test expectation Co-authored-by: Michael Chirico <michaelchirico4@gmail.com> * typo in optparse funciton skip Depends except on object_usage_linter typo need check higher up forgot to supply arg just exit early if Depends unavailable provide an interactive() experience for debugging tweak * add name attribute to Linter class (#753) * add name attribute to Linter class fixes #746 * fix test failures * document() * restore 100% coverage for utils.R * deprecate Lint(linter = ...) and remove all calling instances make expect_lint() resilient to complete removal of the argument * add NEWS bullet * document() * fix lint, collapse with space fix test expectation Co-authored-by: Michael Chirico <michaelchirico4@gmail.com> * typo * vestigial variable name not working from command line testing more debugging Rscript sucks progress -- we need to skip missing Imports too more progress -- skip on platforms without tcl/tk need testing again need to exit early * skip directories with encoding issues * switch conditions * remove tracing Co-authored-by: AshesITR <alexander.rosenstock@web.de>
fixes #746
Things that should be done in this PR:
linter
argument fromLint
. It's overwritten duringlint()
anyway.expect_lint()
to nevertheless recognizelinter
as alint_fields
despite not being an argument ofLint()
.