We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Still following the tutorial at https://cran.r-project.org/web/packages/lintr/vignettes/creating_linters.html
A Lint object is created as:
Lint( filename = source_file$filename, line_number = parsed$line1, column_number = parsed$col1, type = "style", message = "Use <-, not =, for assignment.", line = source_file$lines[parsed$line1] )
According to the help page for Lint, the linter parameter appears optional:
Lint(filename, line_number = 1L, column_number = NULL, type = c("style", "warning", "error"), message = "", line = "", ranges = NULL, linter = NULL)
All good then!
Except that further down the line when executing lint() with a small test case, I get an error message:
Error in vapply(x, `[[`, character(1), "linter") : values must be length 1, but FUN(X[[1]]) result is length 0 10. vapply(x, `[[`, character(1), "linter") 9. data.frame(filename = vapply(x, `[[`, character(1), "filename"), line_number = vapply(x, `[[`, numeric(1), "line_number"), column_number = vapply(x, `[[`, numeric(1), "column_number"), type = vapply(x, `[[`, character(1), "type"), message = vapply(x, ... 8. as.data.frame.lints(lints) 7. as.data.frame(lints) 6. exclude(lints, ...) 5. lint("./R/try_style.R", linters = semicolon_linter) at debugme.R#2 4. eval(substitute(expr), envir, enclos) 3. evalq({ library(lintr) lint("./R/try_style.R", linters = semicolon_linter) }, envir = envir) at debugme.R#1 2. env$fun() 1. debugSource("C:/qc/zoe_home/S001_BaseKit/debugme.R")
The problem is that as.data.frame.lints should accept a linter value of NULL but doesn't.
A small example reproduces the crash:
lints <- structure(list(Lint( filename = "xyz", line_number = 1, column_number = 10, type = "style", message = "Use <-, not =, for assignment.", line = "asdfasdfasdfasdf" )), class = "lints") lintr:::as.data.frame.lints(lints)
If you add a "linter = 'my_linter'", then there is no crash anymore.
Cheers, Florent
The text was updated successfully, but these errors were encountered:
I guess since other text arguments to Lint() default to "" and not NULL, "linter" should also default to "". Here is a patch that implements this fix (with some added tests, of course): 0001-Changed-Lint-s-linter-default-to-prevent-as.data.fra.patch.zip
Sorry, something went wrong.
This was fixed in the Lint() function by giving "linter" the default value "" (commit ae2870d).
No branches or pull requests
Still following the tutorial at https://cran.r-project.org/web/packages/lintr/vignettes/creating_linters.html
A Lint object is created as:
According to the help page for Lint, the linter parameter appears optional:
All good then!
Except that further down the line when executing lint() with a small test case, I get an error message:
The problem is that as.data.frame.lints should accept a linter value of NULL but doesn't.
A small example reproduces the crash:
If you add a "linter = 'my_linter'", then there is no crash anymore.
Cheers,
Florent
The text was updated successfully, but these errors were encountered: