Skip to content

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 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.

No line break after pipe inserted

2 participants