Skip to content

Commit

Permalink
Fix issue with else blocks in Nesting
Browse files Browse the repository at this point in the history
Refs #1029
  • Loading branch information
rrrene committed Mar 2, 2023
1 parent 0b2ff85 commit be3422d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/credo/code/block.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ defmodule Credo.Code.Block do
{:ok, block}
end

def do_block_for(do: do_block, else: _else_block) do
{:ok, do_block}
end

def do_block_for(arguments) when is_list(arguments) do
Enum.find_value(arguments, &find_keyword(&1, :do))
end
Expand Down Expand Up @@ -249,7 +253,9 @@ defmodule Credo.Code.Block do
end
end

defp find_keyword(_, _), do: nil
defp find_keyword(_, _) do
nil
end

@doc """
Returns the children of the `do` block of the given AST node.
Expand Down

0 comments on commit be3422d

Please sign in to comment.