-
Notifications
You must be signed in to change notification settings - Fork 187
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
Add potential sequence()
lints to seq_linter()
#2618
Open
Bisaloo
wants to merge
11
commits into
r-lib:main
Choose a base branch
from
Bisaloo:sequence-linter
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
32049af
Draft sequence_linter linter
Bisaloo 332f861
Fold sequence_linter() into seq_linter()
Bisaloo 405644e
Add tests
Bisaloo 999034c
Add NEWS bullet
Bisaloo 75e56a4
Switch to xml_find_function_calls
Bisaloo 69b4ad2
Change element order in xpath
Bisaloo 396a239
Support lapply(x, seq)
Bisaloo 231abff
Simplify xpath
Bisaloo cfc17ee
Do not lint seq() calls with extra arguments
Bisaloo 072ef13
Edit false positive example
Bisaloo 2a8d243
Add more info about new lints in NEWS
Bisaloo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.
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.
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.
The lint now only covers
unlist(lapply(x, seq_len))
.What about
unlist(lapply(x, seq))
unlist(lapply(x, seq, by = 2))
, and other variants equivalent to using thefrom=
and/orby=
arguments ofsequence()
?lapply(x, \(xi) seq(xi))
which would be covered byunnecessary_lambda_linter()
. But are there any examples that do require looking into a lambda to replicate asequence()
-able call?(it would be nice to get a sense of how many hits these are getting before investing too much time -- and also feel free to earmark some of this as a TODO in a follow-up issue, though
lapply(x,seq)
is trivial enough to be done here)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 don't think there is a direct equivalence:
from
has a different behaviour inseq()
andsequence()
Created on 2024-06-22 with reprex v2.1.0
As far as I can tell,
by=
cannot be used on its own withoutfrom=
, which brings us back to the previous caseCreated on 2024-06-22 with reprex v2.1.0
I have edited the xpath to make sure this type of call doesn't lint.