Skip to content

Commit

Permalink
Add rule for blank lines after multiline assignment (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
corroded committed Mar 8, 2017
1 parent 4b1224a commit 57171df
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,49 @@ Translations of the guide are available in the following languages:
end
```

* <a name="add-blank-line-after-multiline-assignment"></a>
Add a blank line after a multiline assignment as a
visual cue that the assignment is 'over'.
<sup>[[link](#add-blank-line-after-multiline-assignment)]</sup>

```elixir
# not preferred
some_string =
"Hello"
|> String.downcase
|> String.strip
another_string <> some_string

# preferred
some_string =
"Hello"
|> String.downcase
|> String.strip

another_string <> some_string
```

```elixir
# also not preferred
something =
if x == 2 do
"Hi"
else
"Bye"
end
something |> String.downcase

# preferred
something =
if x == 2 do
"Hi"
else
"Bye"
end

something |> String.downcase
```

* <a name="do-with-multi-line-if-unless"></a>
Never use `do:` for multi-line `if/unless`.
<sup>[[link](#do-with-multi-line-if-unless)]</sup>
Expand Down

0 comments on commit 57171df

Please sign in to comment.