-
Notifications
You must be signed in to change notification settings - Fork 10
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
More helpful error message for invalid formats #67
Conversation
Codecov Report
@@ Coverage Diff @@
## main #67 +/- ##
==========================================
+ Coverage 66.18% 68.85% +2.66%
==========================================
Files 10 10
Lines 349 366 +17
==========================================
+ Hits 231 252 +21
+ Misses 118 114 -4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@elimillera @bms63 Not quite sure how to diagnose the R-CMD-checks, besides that what do you think of these proposed changes? |
Hey @zdz2101 I think I fixed the actions for linux os. One is still running as I write |
R/utils-xportr.R
Outdated
fmt_fmts <- function(x) { | ||
fmts <- ntext(length(x), "Format", "Formats") | ||
glue("{fmts} {encode_vals(x)}") | ||
} | ||
|
||
|
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.
is this used somewhere? I see it is new but don't see it being used?
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.
Used up around line 114
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.
oh lol i see can you move it so it comes before that call
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.
If you scroll up a bit, you'll see a few other functions that are also mentioned after where they are called, do you want me to reorganize the entirety of the file such that functions are created before where they are called?
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.
Please just to increase readability for those who come afterwards.
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.
Can you roxygen this file and make it so it doesn't export. Sorry you have to clean up our mess!!
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.
Thanks @zdz2101! I'll be pushing up a some changes to the news file and description but otherwise I think this looks great.
@zdz2101 Sorry. The newly roxygened functions shouldn't be exported unless you think they might be useful to users. I just wanted titles, explanations of function purpose (if you think it is not clear to a new developer) and arguments described properly. Like we do in admiral |
NEWS.md
Outdated
@@ -1,3 +1,6 @@ | |||
# xportr 0.1.0.9000 (development) | |||
* Added a new validation test that errors when users pass invalid formats. Thanks to @zdz2101! |
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.
Can we link the issue here as well?
Ah I see I thought you meant it just isn't exported in the NAMESPACE, which it currently isn't. Although, I think by using roxygen-style comments and a command like |
Apologies for creating confusion. Yes I meant |
ba70a36
to
db7e2d1
Compare
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 looking great. Thanks a lot @zdz2101!! Just the version comment needs to be addressed by @elimillera
Per #60 and #64 , users seem to encounter this error with relative frequency:
"Error: Writing failure: A provided format string could not be understood."
I believe this is actually a
haven
error-message coming from line 55 inR/write.R
:write_xpt(data, path = path, version = 5, name = name)
To remedy this, I propose to add an additional format check inside
xpt_validate()
which is called at line 47 ofR/write.R
, but changes are contained insideR/utils-xportr.R