Skip to content

How does lint_package() work? #228

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

Closed
dfrankow opened this issue Apr 12, 2017 · 6 comments
Closed

How does lint_package() work? #228

dfrankow opened this issue Apr 12, 2017 · 6 comments

Comments

@dfrankow
Copy link

dfrankow commented Apr 12, 2017

Thanks for your work on lintr.

Here is my run:

> lintr::lint_package()
...........Error in rep.int(NA_character_, max(ends - 1)) : invalid 'times' value
In addition: Warning messages:
1: In max(ends - 1) : no non-missing arguments to max; returning -Inf
2: In rep.int(NA_character_, max(ends - 1)) :
  NAs introduced by coercion to integer range

I have no idea what that means or how to debug it. My versions:

> packageVersion("lintr")
[1] ‘1.0.0’
> R.version.string
[1] "R version 3.3.2 (2016-10-31)"

I am also running RStudio 1.0.136. The docs claim that the "Markers" pane shows lint errors, but I don't see a "Markers" pane or how to get it.

@jimhester
Copy link
Member

jimhester commented Apr 12, 2017

Can you provide the output of traceback() after obtaining the error? What package are you trying to lint? Can you lint a specific file with lintr::lint()? Are you using CRAN lintr, or the current development branch?

@dfrankow
Copy link
Author

Thanks for your reply.

Output of traceback:

> traceback()
12: rep.int(NA_character_, max(ends - 1))
11: extract_r_source(source_file$filename, source_file$lines)
10: get_source_expressions(filename)
9: lint(file, ..., parse_settings = FALSE)
8: FUN(X[[i]], ...)
7: lapply(files, function(file) {
       if (interactive()) {
           message(".", appendLF = FALSE)
       }
       lint(file, ..., parse_settings = FALSE)
   })
6: inherits(x, class)
5: assign_item(x)
4: flatten_list(x, class = "lint")
3: structure(flatten_list(x, class = "lint"), class = "lints")
2: flatten_lints(lapply(files, function(file) {
       if (interactive()) {
           message(".", appendLF = FALSE)
       }
       lint(file, ..., parse_settings = FALSE)
   }))
1: lintr::lint_package()

I am trying to lint an internal package I cannot share.

I actually can lint an individual file, and the "Markers" pane appears!

I'm using CRAN lintr. I'll try installing from github..

@dfrankow
Copy link
Author

dfrankow commented Apr 12, 2017

After

devtools::install_github("jimhester/lintr")

I get the same error:

> lintr::lint_package()
............Error in rep.int(NA_character_, max(ends - 1)) : invalid 'times' value
In addition: Warning messages:
1: In max(ends - 1) : no non-missing arguments to max; returning -Inf
2: In rep.int(NA_character_, max(ends - 1)) :
  NAs introduced by coercion to integer range
> traceback()
12: rep.int(NA_character_, max(ends - 1))
11: extract_r_source(source_file$filename, source_file$lines)
10: get_source_expressions(filename)
9: lint(file, ..., parse_settings = FALSE)
8: FUN(X[[i]], ...)
7: lapply(files, function(file) {
       if (interactive()) {
           message(".", appendLF = FALSE)
       }
       lint(file, ..., parse_settings = FALSE)
   })
6: inherits(x, class)
5: assign_item(x)
4: flatten_list(x, class = "lint")
3: structure(flatten_list(x, class = "lint"), class = "lints")
2: flatten_lints(lapply(files, function(file) {
       if (interactive()) {
           message(".", appendLF = FALSE)
       }
       lint(file, ..., parse_settings = FALSE)
   }))
1: lintr::lint_package()
> packageVersion("lintr")
[1] ‘1.0.0.9001’

Also same error from devtools::lint(). It's probably using lint_package?

@dfrankow
Copy link
Author

dfrankow commented Apr 12, 2017

Found a small example to replicate the error.

Put this line in a file (say foo.R) and lint the file:

# \Sexpr{config$foo}

@jimhester
Copy link
Member

Ah that is #127, which should be fixed in the development version, you may have to restart your R session for it to be loaded properly.

@dfrankow
Copy link
Author

Right you are. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants