Skip to content

Commit

Permalink
Fix older Elixir versions for NestedFunctionCalls
Browse files Browse the repository at this point in the history
  • Loading branch information
rrrene committed Dec 11, 2023
1 parent 7c33dc1 commit 4c4234d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 26.1.2
elixir 1.16.0-rc.0-otp-26
erlang 24.0
elixir 1.12.1-otp-24
16 changes: 7 additions & 9 deletions lib/credo/check/readability/nested_function_calls.ex
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,13 @@ defmodule Credo.Check.Readability.NestedFunctionCalls do
end

# A fully qualified call with no arguments
defp traverse({{:., _meta, _call}, _meta2, []} = ast, accumulator, _issue) do
{ast, accumulator}
defp traverse({{:., _meta, _call}, _meta2, []} = ast, acc, _issue) do
{ast, acc}
end

# We don't look into interpolations in strings/binaries
defp traverse({:<<>>, _meta, _args}, acc, _issue) do
{nil, acc}
end

# Any call
Expand Down Expand Up @@ -252,13 +257,6 @@ defmodule Credo.Check.Readability.NestedFunctionCalls do
),
do: true

# Kernel.to_string() in a string interpolation
def cannot_be_in_pipeline?(
{{:., _, [Kernel, :to_string]}, meta, _} = ast,
_excluded_functions,
_excluded_argument_types
), do: meta[:from_interpolation]

# Elixir <= 1.8.0
# '__#{val}__' are compiled to String.to_charlist("__#{val}__")
# we want to consider these charlists a valid pipe chain start
Expand Down

0 comments on commit 4c4234d

Please sign in to comment.