-
Notifications
You must be signed in to change notification settings - Fork 9
Improve log validation error formatting with CLI styling #159
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
Conversation
simonpcouch
left a comment
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 so much for making this happen! Was great to meet you.
These changes seem reasonable, though I'm a bit too scatterbrained post-conf to review thoughtfully at the moment. I'm about to step away from work for 3 weeks—I'll come back to this once I'm back at work!
Safe travels to you on your way back from conf.
|
Sounds good. Was great to meet you too, and have a great vacation! Talk to you in 3 weeks 😄 |
simonpcouch
left a comment
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.
Loving these changes so much. Thank you!!
Pushing a few edits here in a moment that are mostly style-related; no changes to functionality.
tests/testthat/helper-valid_log.R
Outdated
| "The generated log did not pass the pydantic model:", | ||
| glue::glue("{{.field {result[1]}}}") | ||
| )) | ||
| } else { |
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.
To simplify this control flow, I am going to remove this else and then return early from the if condition.
tests/testthat/helper-valid_log.R
Outdated
| glue::glue("{{.field {result[1]}}}") | ||
| )) | ||
| } else { | ||
| # Get rid of elements starting with "For further information visit" |
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 will remove most of these "what" comments in favor of one "why" comment
# Make the result more readable by removing redundant elements
# and formatting indices with cli (#159)
Simon, I ended up using
cli::format_message()to see cli-styled messages fromtestthat::expect(). One other change I've made since Tidy Dev Day is to account for single-line error messages (i.e.Error: Expecting ',' delimiter: line 165 column 13 (char 3699) with anif elsestatement.Fixes #148