Skip to content
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

Line break after pipe #503

Merged
merged 5 commits into from May 3, 2019
Merged

Conversation

lorenzwalthert
Copy link
Collaborator

@lorenzwalthert lorenzwalthert commented May 2, 2019

This PR implements the rule that %>% must usually be followed by a new line. 99% of the cases are:

blue %>% green() 
# is turned into
blue %>%
  green()

Exceptions are various constellations within function calls. This is discouraged practice anyways but we don't want to make things worse

call(a, b %>% c())

# won't be turned into
call(
  a, b %>% 
    c()
)
# or similar

See test files added in this PR for more examples.

Reason: It's not non-invasive and comes at a technically high cost (relatively large slow-down for edge case), more complex code.

call(d = g(b) %>% 
  c)

should probably be turned into

call(
  d = g(b) %>% 
    c
)

But it is not, again because of the same reasons. A more natural choice would be

call(d = g(b) %>% c)

in many cases.

This closes #470.

@codecov-io
Copy link

@codecov-io codecov-io commented May 3, 2019

Codecov Report

Merging #503 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #503      +/-   ##
==========================================
- Coverage   90.26%   90.25%   -0.02%     
==========================================
  Files          39       39              
  Lines        1675     1672       -3     
==========================================
- Hits         1512     1509       -3     
  Misses        163      163
Impacted Files Coverage Δ
R/style-guides.R 100% <100%> (ø) ⬆️
R/rules-line-break.R 100% <100%> (ø) ⬆️
R/transform-files.R 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 37381a3...f8b39ef. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants