From b0ab1f24e139da313979b5c4d62adc43cf686fdb Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Mon, 9 Oct 2023 13:42:14 -0400 Subject: [PATCH] fix: fix spark.formatter plugin not removing all parens --- lib/spark/formatter.ex | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/spark/formatter.ex b/lib/spark/formatter.ex index d997bd2..9ab66d0 100644 --- a/lib/spark/formatter.ex +++ b/lib/spark/formatter.ex @@ -269,7 +269,9 @@ defmodule Spark.Formatter do {func, meta, body} = node when is_atom(func) -> count = Enum.count(List.wrap(body)) - if builders[func] in [count, count - 1] && Enum.count(List.wrap(body)) && + builders = Keyword.get_values(builders, func) + + if Enum.any?(builders, &(&1 in [count, count - 1])) && Keyword.keyword?(meta) && meta[:closing] do {func, Keyword.delete(meta, :closing), body}