File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed
test/credo/check/readability Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -94,7 +94,22 @@ defmodule Credo.Check.Readability.NestedFunctionCallsTest do
9494 |> refute_issues ( )
9595 end
9696
97- test "it should NOT two nested functions calls when the inner function call takes no arguments" do
97+ test "it should NOT report nested function calls when the outer function is already in a pipeline" do
98+ """
99+ defmodule CredoSampleModule do
100+ def some_code do
101+ [1,2,3,4]
102+ |> Test.test()
103+ |> Enum.map(SomeMod.some_fun(argument))
104+ end
105+ end
106+ """
107+ |> to_source_file ( )
108+ |> run_check ( NestedFunctionCalls )
109+ |> refute_issues ( )
110+ end
111+
112+ test "it should NOT report two nested functions calls when the inner function call takes no arguments" do
98113 """
99114 defmodule CredoSampleModule do
100115 def some_code do
@@ -158,4 +173,21 @@ defmodule Credo.Check.Readability.NestedFunctionCallsTest do
158173 |> run_check ( NestedFunctionCalls , min_pipeline_length: 3 )
159174 |> refute_issues ( )
160175 end
176+
177+ test "it should report nested function calls inside a pipeline when the inner function calls could be a pipeline of their own" do
178+ """
179+ defmodule CredoSampleModule do
180+ def some_code do
181+ [1,2,3,4]
182+ |> Test.test()
183+ |> Enum.map(fn(item) ->
184+ SomeMod.some_fun(another_fun(item))
185+ end)
186+ end
187+ end
188+ """
189+ |> to_source_file ( )
190+ |> run_check ( NestedFunctionCalls )
191+ |> assert_issue ( )
192+ end
161193end
You can’t perform that action at this time.
0 commit comments