Skip to content
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

lintr::lint_package gives warning but expect_lint_free succeeds. #406

Closed
stefanoborini opened this issue Sep 12, 2019 · 2 comments
Closed
Labels
reprex-needed needs a minimal reproducible example

Comments

@stefanoborini
Copy link

I have the following report from lintr

Rscript -e "lintr::lint_package()"
R/redacted.R:138:14: warning: no visible global function definition for ‘.weight’, Did you mean 'weights'?
  Answers <- .weight(start, X, accuracy)
             ^~~~~~~

However, when I use testthat to invoke lintr::expect_lint_free()

if (requireNamespace("lintr", quietly = TRUE)) {                                          
  context("lints")                                                                        
  test_that("Package Style", {                                                            
    lintr::expect_lint_free()                                                             
  })                                                                                      
}            

The result of the test is successful

✔ | OK F W S | Context
✔ |  1       | lints [3.2 s]
@jimhester jimhester added the reprex-needed needs a minimal reproducible example label Sep 24, 2019
@jimhester
Copy link
Member

Likely this is due to the package not being installed on your system in the first case, but you have not given enough context to reproduce the issue.

@stefanoborini
Copy link
Author

@jimhester the lack of failure is due to the fact that the whole execution is skipped silently as from #407

jonkeane pushed a commit to apache/arrow that referenced this issue Aug 2, 2022
The package should be installed before running `lintr::ling_package()` or `lintr::expect_lint_free()` (our case), otherwise we could encounter some false positives.

See r-lib/lintr#352 (comment) and r-lib/lintr#406 (comment)


Authored-by: Dragoș Moldovan-Grünfeld <dragos.mold@gmail.com>
Signed-off-by: Jonathan Keane <jkeane@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reprex-needed needs a minimal reproducible example
Projects
None yet
Development

No branches or pull requests

2 participants