Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
René Föhring committed Nov 6, 2020
1 parent 179da52 commit df71511
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/credo/check/readability/block_pipe.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,23 @@ defmodule Credo.Check.Readability.BlockPipe do
... should be refactored to look like this:
maybe_nested_lists = list
|> Enum.take(5)
|> Enum.sort()
maybe_nested_lists =
list
|> Enum.take(5)
|> Enum.sort()
case maybe_nested_lists do
[[_h|_t]|_] -> true
_-> false
[[_h | _t] | _] -> true
_ -> false
end
... or create a new function
... or create a new function:
list
|> Enum.take(5)
|> Enum.sort()
|> contains_nested_list?()
Piping to blocks may be harder to read because it can be said that it obscures intentions
and increases cognitive load on the reader. Instead, prefer introducing variables to your code or
new functions when it may be a sign that your function is getting too complicated and/or has too many concerns.
Expand Down

0 comments on commit df71511

Please # to comment.