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

Check exclusive #375

Closed
wants to merge 3 commits into from
Closed

Conversation

jonthegeek
Copy link

Closes #374

I updated all other errors in make_selector() to what I believe to be the current preferred style, but did not update everything in find_href() in case I'm wrong about the preference.

Copy link
Member

@hadley hadley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! Let me know if you're interested in finishing this off, otherwise I'm happy to do so.

if (!missing(css) && !missing(xpath))
stop("Please supply css or xpath, not both", call. = FALSE)
make_selector <- function(css, xpath, call = rlang::caller_env()) {
switch(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest keeping the basic flow of the function the same, just calling check_exclusive() (without the rlang::) first. I'd suggest you leave the string checking messages as is in this PR, as those would be better handled with the standalone rlang input checkers.

@@ -78,30 +78,32 @@ html_elements <- function(x, css, xpath) {

#' @export
html_elements.default <- function(x, css, xpath) {
xml2::xml_find_all(x, make_selector(css, xpath))
xpath <- make_selector(css, xpath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these functions can stay the same too.

@jonthegeek
Copy link
Author

I can finish it off in a day or two!

I'll need to remember why I made those changes you called out to see if I want to argue for them; right now I can't remember, but I assume I had an argument for them at the time.

I'll likely have more questions about what you want when I get a chance to dig into this!

@jonthegeek
Copy link
Author

Should I update the workflow to match something more recently updated (eg httr2) while I'm at it, to kill those ubuntu-18.04 failures?

@hadley
Copy link
Member

hadley commented Jan 23, 2024

I don't see the failures on main, so you should just be able to rebase/merge from main.

@hadley
Copy link
Member

hadley commented Jan 23, 2024

Actually, I just started converting the error to use cli, so it might be just as easy for me to do check_exclusive() while I'm in here.

@jonthegeek
Copy link
Author

Ok, I won't be offended if you go ahead and clear this out without me! I'll be happy to review, and I'll still try to figure out why I felt the need to change other things!

@hadley
Copy link
Member

hadley commented Jan 23, 2024

Done in #386. I'm sure there's still plenty of room for improvement though.

@hadley hadley closed this Jan 23, 2024
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

Successfully merging this pull request may close these issues.

Use rlang::check_exclusive()
2 participants