-
Notifications
You must be signed in to change notification settings - Fork 186
pipes (%>%) in single lines get marked by lintr #366
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
Comments
That's funny. There is a
|
Further checks: Passes without comment:
Also, Passes without comment:
But, Throws Error:
|
At present, the
The reprex contains an expression that spans multiple lines (the definition of I suspect that nesting pipelines in other settings may throw the same lint (eg, in the body of a
|
I think the examples with I have no strong opinion about the An example, where linters are appropriate in my opinion are functions that have multiple NSE arguments like the # this should throw a linter
dplyr::mutate(
mtcars,
am = am %>% as.character() %>% as.factor(),
cyl = cyl %>% as.character() %>% as.factor()
) |
OK. The final example complicates things a bit in my mind (since each pipeline it contains is restricted to a single codeline). I was thinking we might be able to do something like:
|
I approve this suggestion. In this case one could also adapt the message produced by the linter from
to something that reflects this logic more closely. |
I just installed this package and faced an issue with single line pipes. I have a function that basically looks like this.
lintr::lint_package()
adds a style-marker here because of missing newlines. Is this behavior expected? Here is an actual repex: r-webutils/suitr@4f6f97eThe text was updated successfully, but these errors were encountered: