-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Add --no-update flag to spell-check #511
Conversation
The else branch would write an unaltered list read from inst/WORDLIST or `character()` to a file.
LGTM, can you add a test? |
Done! I went ahead and tweaked the test framework a bit to allow for checking post-hook state. |
Hey, I have noticed that I have not generated roxygen beforehand. I couldn't get it fixed in time, though, because I ran into problems with However, right now I am getting errors from pkgdown hook locally, because pkgdown is not installed.
How do you suggest to approach this? |
Right approach.
Yes
You should not change the hook type as a user (now you are a user if you want to commit in that repo and the hooks fail). What is the error message you get exactly? |
The error:
I figured it out. I had an |
I recommend emitting a message in these config files because as you did, one tends to forget |
What do you think of specifying I couldn't help but notice that If this gets green light, would you like a separate PR for this change? |
R/testing.R
Outdated
@@ -43,7 +43,8 @@ run_test <- function(hook_name, | |||
artifacts = NULL, | |||
file_transformer = function(files) files, | |||
env = character(), | |||
expect_success = is.null(std_err)) { | |||
expect_success = is.null(std_err), | |||
post_hook_assert = NULL) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can default to invisible
(the function) and avoid the if statement further down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually no wait a sec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the function is necessarily an assertion. I think it makes more sense to introduce the notion of read-only hooks in the testing, as we already have it in the docs for every hook. Can run_test()
gain a read_only
argument and then you compare the input file and output file and assert it did not change if that flag is set? I know that's beyond this hook alone, so if you want, can you open a separate PR? Because as I commented in other PRs, I am inclined to be conservative with extention of the testing main function and it seems this addition is too general (function can do anything, but you really actually just want to check if contents are the same).
If you don't want to contribute the read_only
change in the testing framework or not, I don't think we should add the post_hook_assert
argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds reasonable. To paraphrase: we add an additional assertion to hook_state_assert_one
based on read_only
argument that is derived from the nature of the hook? In this case, of testing spell-check, we would test it in both scenarios. Is that right? It might make sense to rename the flag to --read-only
, so it is more generic and can be shared across other hooks.
I have started working on the change as I understood it and outlined above, however I keep running into roxygenize tests failing, even on a clean main branch.
── Failed tests ── Failed tests ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Error (test-hooks.R:394:1): (code run outside of `test_that()`)
<purrr_error_indexed/rlang_error/error/condition>
Error in `purrr::map2(path_candidate, path_candidate_temp, hook_state_assert_one,
tempdir = tempdir, file_transformer = file_transformer, path_stdout = path_stdout,
path_stderr = path_stderr, expect_success = expect_success,
std_err = std_err, std_out = std_out, exit_status = exit_status)`: ℹ In index: 1.
ℹ With name: man/flie.Rd.
Caused by error:
! in/flie.Rd and /private/var/folders/lh/y7zmk_td7nzfjxxqxdwhy5r40000gn/T/RtmpLxX4J1/fileeaf15c5ae334/man/flie.Rd are not supposed to be identical but they are
[ FAIL 1 | WARN 0 | SKIP 1 | PASS 71 ]
Do you have an idea where that comes from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All great, exactly. This failure occurred as well in previous CI runs. Don’t know why. Try updating roxygen and other deps. Otherwise You can ignore it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is still unresolved. Right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct! I have a rough draft for the testing framework change, but haven't had an opportunity to clean it up and publish just yet.
Uh, that I did not know. Yes please, separate PR. |
@lorenzwalthert done 👌 |
Thanks, can you also update the vignette Available hooks to reflect the added argument? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. Thanks. Wanna add some read only flags to some other hooks? Candidates are basically all write hooks. for styler, native dry run option could be used, roxygenize seems a bit more tricky…
Closes #510