Repository navigation
New inner_combine_linter - #1012
Merged
Merged
Conversation
38 tasks done
AshesITR
reviewed
Mar 28, 2022
AshesITR
reviewed
Mar 28, 2022
Comment on lines
+43
to
+67
| date_args_cond <- xp_or( | ||
| sprintf("not(expr[SYMBOL_FUNCTION_CALL[%s]])", xp_text_in_table(date_funs)), | ||
| "not(SYMBOL_SUB) and not(following-sibling::expr/SYMBOL_SUB)", | ||
| do.call(xp_and, as.list(vapply(date_args, arg_match_cond, character(1L)))) | ||
| ) | ||
|
|
||
| log_args_cond <- xp_or( | ||
| sprintf("not(expr[SYMBOL_FUNCTION_CALL[%s]])", xp_text_in_table(log_funs)), | ||
| "not(SYMBOL_SUB) and not(following-sibling::expr/SYMBOL_SUB)", | ||
| arg_match_cond("base") | ||
| ) | ||
|
|
||
| c_expr_cond <- xp_and( | ||
| sprintf( | ||
| "expr[SYMBOL_FUNCTION_CALL[%s]]", | ||
| xp_text_in_table(c(no_arg_vectorized_funs, date_funs, log_funs)) | ||
| ), | ||
| "not(following-sibling::expr[not(expr[SYMBOL_FUNCTION_CALL])])", | ||
| sprintf( | ||
| "not(%1$s != following-sibling::expr/%1$s)", | ||
| "expr/SYMBOL_FUNCTION_CALL" | ||
| ), | ||
| date_args_cond, | ||
| log_args_cond | ||
| ) |
Collaborator
There was a problem hiding this comment.
glue() these as well?
Very hard to read with the nested sprintf() calls.
Collaborator
Author
There was a problem hiding this comment.
Refactored a little bit, hopefully a bit better.
AshesITR
reviewed
Mar 28, 2022
AshesITR
reviewed
Mar 28, 2022
| # still preferable to vectorize the call, while being sure to use a | ||
| # consistent format for the inputs. In this case, the correct equivalent | ||
| # call is as.POSIXct(c("2021-01-01 00:00:00", "2021-01-01 01:00:00")). | ||
| # See http://google3/analysis/economics/r/izeitgeist/tests/testthat/test-izeitgeist.R;l=1058-1062;rcl=394984377. |
# Conflicts: # man/linters.Rd
AshesITR
approved these changes
Mar 28, 2022
This file contains hidden or 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
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.
Part of #962
This one is somewhat of a mess... easy enough to describe what it wants to do, and it did match a bunch of our internal code. But a bit of a mess to write the linter.