Skip to content

Autobrace for loops, while loops, repeat loops, and function definitions #344

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

Open
wants to merge 14 commits into
base: feature/if-else-bracing
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,45 @@

# Development version

- Autobracing is a new feature applied to if statements, for loops, while loops,
repeat loops, and function definitions. This feature will automatically add
`{}` around the body of these code elements in certain cases to maximize
readability, consistency, and portability (#225, #334).

For example:

```r
if (condition)
a

# Becomes:
if (condition) {
a
}
```

```r
fn <- function(
a, b
) a + b

# Becomes:
fn <- function(
a,
b
) {
a + b
}
```

Single line if statements and function definitions are still allowed in certain contexts:

```r
list(a = if (is.null(x)) NA else x)

map(xs, function(x) x + 1)
```


# 0.5.0

Expand Down
Loading