-
Notifications
You must be signed in to change notification settings - Fork 11
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
Use cli package in read_
functions
#181
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…require a name The previous assertion checked for: 1. Resources property missing 2. Resources property = empty list 3. Resources do not have a name That last assertion is removed, so it is now possible to read a package where not all the resources have a name. For any later step however, check_package() requires all resources to have a name. See class "frictionless_error_resources_without_name". I did not want to include this test in two places. Note also that name might not be required anymore in frictionless v2. Ping @PietrH
It's a general feature of cli, which I don't consider necessary to document here.
Originally: ``` field_names <- purrr::map_chr(fields, ~ purrr::pluck(.x, "name")) col_names <- purrr::map_chr(fields, ~ replace_null(.x$name, NA_character_)) ``` Both are derived from fields, but col_names had an (untested) assert that the fields were not NA. That "frictionless_error_fields_without_name" test however is already part of check_schema(), which is called in get_schema(), which is called in read_resource(), so fields without name will never be passed. Since col_names is the same as field_names in the function, we should only have one variable.
Ping @PietrH: This change is a good example of how nicely cli takes care of collapsing, pluralization, etc.
35 tasks
I notice in other packages (and style guides) that NEWS.md is hard-wrapped at 80 chars and has lots of spacing between bullet items. I find this annoying: - It renders ok (wrapping and spacing is ignored) on GitHub and pkgdown website. - But the text is also often copy/pasted for GitHub and Zenodo releases, where the hard-wrapping is not ignored. In addition, this is a pure Markdown file, I rather use the Markdown conventions over the R conventions.
damianooldoni
approved these changes
Mar 19, 2024
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.
Nice! A pair of wrong links but the rest seems ok to me.
Don't hardwrap text in news
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR completes #163.
cli
calls are used inread_
functions.rlang::local_options()
but kept thesuppressMessages()
, as advised in testthat.col_names
variable is removed fromread_resource()
.datapackage.json
, it is no longer required that all resources have a name 0c7b752. When reading a resource, it still is.