precommit
precommit copied to clipboard
Exclude testthat snapshots from EOF hook
I had mysterious issues with my snapshots, which turned out to be caused by the eof hook changing the .md
files.
This is of course easily solved with exclude: '\.Rd|_snaps/'
but should maybe added to the default yaml to avoid this issue from the get go :)
Thanks. We could do that. But I think it's inherently a {testthat} problem, because it's quite generally accepted that there should be an empty line at EOF. Similar for .Rd
files, where I excluded it already. I think we should create issues for both, then exclude it in the template for a transition phase and then remove it later (maybe).
I can't seem to find the problem with {roxygen2} anymore. There is https://github.com/r-lib/roxygen2/issues/593, but neither {styler} nor {precommit} has any file in man/
where the trailing line break is missing. Do you want to post a reprex in r-lib/testthat?
Also note there were some discussions around this recently, maybe see if the problem persists with the dev version of {testthat}? https://github.com/r-lib/testthat/issues/1509
I tested it briefly but it still did not work with the testthat dev version. I will have a look some other day to make sure it's not me/my setup
Also, I think using exclude: '(\.Rd|^tests/testthat/_snaps/.*\.md)$
is also pretty non-ambiguous (if I got the regex right). Is it always .md
?
@assignUser should we exclude: '(\.Rd|^tests/testthat/_snaps/.*\.md)$
?
Sounds good :)
@assignUser any interest in contributing? Otherwise I'd close.
Ah sorry, I missed this. Don't have the bandwidth atm so the close is fine :)