-
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 pipe consistency linter #2018
Conversation
Thanks for the PR! I first have a high-level concern. the design here is slightly different than I think that makes sense given the current state of the style guide (which doesn't offer a preference for any particular pipe). But what about if/when (see tidyverse/style#188) in the future the style guide becomes more opinionated about pipes? I think it may make more sense to name this CC @IndrajeetPatil @AshesITR for design insights |
Hi, I think this is a good idea. I did think about implementing a preference argument in this (I suspect many organisations already have internal style preferences for pipes), but didn't as I thought it might be better as a separate linter as it would be a slightly different rule it's enforcing. However, your suggestion covers all use cases to do with pipes. It would make sense to make |
Agreed, this seems like a good idea to control via argument. The automatic option could be |
Codecov Report
@@ Coverage Diff @@
## main #2018 +/- ##
=======================================
Coverage 99.64% 99.65%
=======================================
Files 112 113 +1
Lines 5134 5166 +32
=======================================
+ Hits 5116 5148 +32
Misses 18 18
|
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.
Well done. Looks good to me, just not sure about the wording in the docs. @MichaelChirico PTAL and feel free to merge.
Co-authored-by: Michael Chirico <[email protected]>
Co-authored-by: Michael Chirico <[email protected]>
I have added the support for the other magrittr types. One issue that this raises is the lint messages, as these refer specifically to Does extra handling need to be added to identify other magrittr type use, and show appropriate messages? |
Since |
Hi @bairdj, we're closing in on sealing up a release (lintr 3.1.1). If you'd like this PR included, please take a chance to wrap up. If you'd like it included and won't have time to work on it in the next few weeks, let us know and we can try taking over from here. Thanks! |
Hi @MichaelChirico, I think everything has been addressed so this should be ready to go |
New linter to check for the consistent use of pipe operators - either the magrittr %>% or the native |>.
This linter is quite simple - it counts the occurrences of each operator, and if both of the counts are non-zero, it generates lints. The lints are generated at each occurrence of the pipe operator.
Fixes #1052