From df715114045abf73e562e158b7fb057a6fed5b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20F=C3=B6hring?= Date: Fri, 6 Nov 2020 07:23:04 +0100 Subject: [PATCH] Update docs --- lib/credo/check/readability/block_pipe.ex | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/credo/check/readability/block_pipe.ex b/lib/credo/check/readability/block_pipe.ex index 598b36047..ef32f004a 100644 --- a/lib/credo/check/readability/block_pipe.ex +++ b/lib/credo/check/readability/block_pipe.ex @@ -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.