Skip to content

Conversation

@kieranjmartin
Copy link

Resolves #514

Incorportating check_ard_structure into as_card proved to not be straight forwards as as_card is used throughout the code base to coerce objects into a card class that do not pass the checks in check_ard_structure.

For now at least I did the following

  1. check_ard_structure can either error or warn based on user input. I made a function to switch between these (I couldn't see any function which existed to do this already). Part of me wonders about allowing the user a bit more control over what it considers an error or a warning; they can switch off caring about the column order, and whether there is a methods entry, but maybe we could allow more in future. That said I think it's probably better as a binary switch for a change
  2. In as_card, there is now an argument for whether you want to check if a card follows this structure. At the moment this defaults to TRUE, but if you think this is too strong I could switch it to default FALSE. Doing that would be the most low impact change.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 15, 2025

✅ All contributors have signed the CLA
Posted by the CLA Assistant Lite bot.

@kieranjmartin
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

.message_or_error(
"The following columns are expected to be list columns: {.val {not_a_lst_columns}}.",
error = error_on_fail,
envir = environment()
Copy link
Contributor

Choose a reason for hiding this comment

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

is this needed if default is rlang::current_env()?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I made a change so that it used calling_env() instead, which works and now I no longer need to pass the environment explicitly.

R/utils.R Outdated
Comment on lines 112 to 113
#' cards:::..warn_or_error("This will be a message", FALSE)
#' cards:::..warn_or_error("This will be an error", TRUE)
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be message_or_error right?

Copy link
Author

Choose a reason for hiding this comment

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

yes, and too many dots too! Fixed... the dangers of \donotrun ...

#' Environment to evaluate the glue expressions in passed in `cli::cli_abort(message)`.
#' Default is `rlang::current_env()`
#' @inheritParams cli::cli_abort
#' @return Invisible NULL
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure this is needed. Also it is internal

Copy link
Author

Choose a reason for hiding this comment

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

This is consistent with the documentation above though?

Melkiades and others added 10 commits December 16, 2025 17:22
Co-authored-by: Davide Garolini <dgarolini@gmail.com>
Signed-off-by: Kieran Martin <kieranjmartin@gmail.com>
Co-authored-by: Davide Garolini <dgarolini@gmail.com>
Signed-off-by: Kieran Martin <kieranjmartin@gmail.com>
Co-authored-by: Davide Garolini <dgarolini@gmail.com>
Signed-off-by: Kieran Martin <kieranjmartin@gmail.com>
Co-authored-by: Davide Garolini <dgarolini@gmail.com>
Signed-off-by: Kieran Martin <kieranjmartin@gmail.com>
Co-authored-by: Davide Garolini <dgarolini@gmail.com>
Signed-off-by: Kieran Martin <kieranjmartin@gmail.com>
Co-authored-by: Davide Garolini <dgarolini@gmail.com>
Signed-off-by: Kieran Martin <kieranjmartin@gmail.com>
Co-authored-by: Davide Garolini <dgarolini@gmail.com>
Signed-off-by: Kieran Martin <kieranjmartin@gmail.com>
kieranjmartin and others added 3 commits December 29, 2025 09:52
Co-authored-by: Davide Garolini <dgarolini@gmail.com>
Signed-off-by: Kieran Martin <kieranjmartin@gmail.com>
@ddsjoberg ddsjoberg requested a review from bzkrouse January 5, 2026 18:51
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.

Feature Request: Handle list columns

3 participants