You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have installed the latest dev version of {precommit} with remotes::install_github('lorenzwalthert/precommit')
I have installed the latest hook revisions (update with precommit::autoupdate())
I have installed the latest release of the upstream Python framework pre-comit as described under the update instructions.
Describe the bug
My R package has internal Rcpp code that is called within a user-facing R function. When I run lintr::lint_package() everything passes. When I commit changes to the *.R file, the lintr hook fails. In the output below, addition() is a file written with {Rcpp}. {Rcpp} was added to the package with usethis::use_rcpp()
$ git commit -m "Trigger precommit hook"
style-files..............................................................Passed
use-tidy-description.................................(no files to check)Skipped
spell-check..............................................................Passed
lintr....................................................................Failed
- hook id: lintr
- exit code: 1
File `R/hello.R` is not lint free
/Users/pschloss/Desktop/test/R/hello.R:8:3: warning: [object_usage_linter] no visible global function definition for 'addition'
addition(c(1, 2, 3))
^~~~~~~~
Error: File R/hello.R is not lint free
Execution halted
readme-rmd-rendered..................................(no files to check)Skipped
parsable-R...............................................................Passed
no-browser-statement.....................................................Passed
no-print-statement.......................................................Passed
no-debug-statement.......................................................Passed
deps-in-desc.............................................................Passed
pkgdown..............................................(no files to check)Skipped
check for added large files..............................................Passed
file contents sorter.................................(no files to check)Skipped
fix end of files.........................................................Passed
check pre-commit.ci config...........................(no files to check)Skipped
Don't commit common R artifacts......................(no files to check)Skipped
To Reproduce
A minimal package is available here. It is the default package generated from RStudio with {Rcpp} and {precommit} loaded. There is an additional file, addition.cpp in src/. It runs as expected and passes the build check.
Expected behavior
Running lintr::lint_package() passes without any issues. I'd expect the same when running the pre-commit hook
Additional context
My operating system is: Mac OS X
My project uses {renv}.
the output of packageVersion('renv')
The text was updated successfully, but these errors were encountered:
Thanks. The reason is that your package won't be devtool::load_all() so object_usage_linter won't work always it seems as explained in #440. Workarounds also there.
Before filing a bug
remotes::install_github('lorenzwalthert/precommit')
precommit::autoupdate()
)Describe the bug
My R package has internal Rcpp code that is called within a user-facing R function. When I run
lintr::lint_package()
everything passes. When I commit changes to the*.R
file, the lintr hook fails. In the output below,addition()
is a file written with {Rcpp}. {Rcpp} was added to the package withusethis::use_rcpp()
To Reproduce
A minimal package is available here. It is the default package generated from RStudio with {Rcpp} and {precommit} loaded. There is an additional file,
addition.cpp
insrc/
. It runs as expected and passes the build check.Expected behavior
Running
lintr::lint_package()
passes without any issues. I'd expect the same when running the pre-commit hookAdditional context
packageVersion('renv')
The text was updated successfully, but these errors were encountered: