Skip to content

Commit 57171df

Browse files
authored
Add rule for blank lines after multiline assignment (#138)
1 parent 4b1224a commit 57171df

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,49 @@ Translations of the guide are available in the following languages:
291291
end
292292
```
293293

294+
* <a name="add-blank-line-after-multiline-assignment"></a>
295+
Add a blank line after a multiline assignment as a
296+
visual cue that the assignment is 'over'.
297+
<sup>[[link](#add-blank-line-after-multiline-assignment)]</sup>
298+
299+
```elixir
300+
# not preferred
301+
some_string =
302+
"Hello"
303+
|> String.downcase
304+
|> String.strip
305+
another_string <> some_string
306+
307+
# preferred
308+
some_string =
309+
"Hello"
310+
|> String.downcase
311+
|> String.strip
312+
313+
another_string <> some_string
314+
```
315+
316+
```elixir
317+
# also not preferred
318+
something =
319+
if x == 2 do
320+
"Hi"
321+
else
322+
"Bye"
323+
end
324+
something |> String.downcase
325+
326+
# preferred
327+
something =
328+
if x == 2 do
329+
"Hi"
330+
else
331+
"Bye"
332+
end
333+
334+
something |> String.downcase
335+
```
336+
294337
* <a name="do-with-multi-line-if-unless"></a>
295338
Never use `do:` for multi-line `if/unless`.
296339
<sup>[[link](#do-with-multi-line-if-unless)]</sup>

0 commit comments

Comments
 (0)