-
Notifications
You must be signed in to change notification settings - Fork 71
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 newline after multiline function declaration #371
Comments
Is there a corresponding rule in the tidyverse style or do you plan to add one? |
I remember Hadley suggested that an empty line after a long function header helps readability. I wouldn't formalize this as a rule yet, but I've seen this pattern a few times in dplyr. |
Ok. I think this is easy to implement. I just think for the sake of consistency, we should in general aim to keep the style guide in sync with styler. |
For a propper implementation, we'd need #357 because we want to add a line break dependent on whether a token is multi-line, which we cannot do if the multi-line attribute is not up-to date. The multi-line attribute is not up-to-date because it is only updated after all line break rules were applied. |
Blocked by #357. |
Implemented in mlr branch: lorenzwalthert@2a3fbc6 |
The implementation in the mlr branch now depends on the number of lines in the body. |
Wrong. We need the exact line count, |
@krlmlr any specific examples of this pattern? 🙏 |
For context I was looking into never removing the newline at the beginning of a function body if there was one, following a comment by @mpadge. 😁 |
I have tweaked the "bad" example in the original post. Keeping an extra newline, at least in non-strict mode, doesn't sound too bad as a starter. |
That's what I had guessed it should be. 😁 |
The text was updated successfully, but these errors were encountered: