-
Notifications
You must be signed in to change notification settings - Fork 195
Create list2df_linter() #2834
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
Create list2df_linter() #2834
Conversation
bdb9b18 to
c3c3f97
Compare
|
quick feedback: let's name it similarly, we have |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2834 +/- ##
=======================================
Coverage 99.64% 99.64%
=======================================
Files 126 127 +1
Lines 6960 6979 +19
=======================================
+ Hits 6935 6954 +19
Misses 25 25 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Had a go at refining the wording here too, PTAL |
|
Strange, I get this error in r-devel |
|
Looks like it's due to a lambda in lint("do.call(function(x) x, l)\n", list2df_linter())
# Error in `lint()`:
# ! Linter `linter()` failed in /tmp/RtmpTKzzIM/file1393690d1c43:
# Caused by error in `xml_nodeset()`:
# ! Expecting an external pointer: [type=NULL]
# Run `rlang::last_trace()` to see where the error occurred. |
|
The edits look good to me. Thanks! I can indeed still reproduce the |
Hmm, how do you figure? it's being generated by {lintr} code and only from this new linter. |
No, you're right. For some reason, I was under the impression this happened at the parsing stage, before reaching lintr, but it was incorrect. I have added a test for this, fixed the immediate issue, and added an extra |
R/list2df_linter.R
Outdated
| docall_nolambda_xpath <- " | ||
| //SYMBOL_FUNCTION_CALL[text() = 'do.call'] | ||
| /parent::expr | ||
| /following-sibling::expr[1][SYMBOL or STR_CONST] |
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.
right now, the linter will land on the first argument, is that the best place? Or should we include the whole do.call expression? (not immediately clear to me, though I lean towards the latter)
do.call(cbind.data.frame, ...)
^ ~ current |
^ alternative |
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 agree. I have done this by adding an xml_find_all(, "./parent::expr") before returning. Please let me know if this is not the preferred option.
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.
let's use xml_parent() in that case
Co-authored-by: Michael Chirico <chiricom@google.com>
|
Hi @MichaelChirico, since I have made a couple of (minor) changes since you approved, I am not completely sure if I should go ahead and merge this. |
Fix #2596