epiverse-trace / datatagr

Tagging, validating, and safeguarding data to help harden data pipelines.
https://epiverse-trace.github.io/datatagr/
Other
1 stars 0 forks source link

Evaluate the necessity of the custom `modify_defaults()` function #16

Closed Bisaloo closed 1 month ago

Bisaloo commented 2 months ago

I don't exactly remember if/why this function was necessary.

I also think that modifyList() has been updated in the last couple of years and might now be appropriate to use directly.

We should evaluate if modify_defaults() is really necessary or can be replaced by modifyList().

In all cases, this function should have more & better comments:

chartgerink commented 2 months ago

Thanks for this report 😊 Before I open the pull request where I address this, I document my evaluation as requested.

The primary code in modify_defaults that adds to the modifyList part is the following:

extra <- setdiff(names(x), names(defaults))
  if (strict && (length(extra) > 0L)) {
    stop(
      "Unknown variable types: ",
      toString(extra),
      "\n  ",
      "Use only known tags or set `allow_extra = TRUE`",
      call. = FALSE
    )
  }

This primarily is to check for known tags. Given that #22 indicates this can be dropped altogether, modify_defaults is indeed redundant. Will be removing this function and ensuring everything remains functional. 👍