From e860b1f9d3d93eaac13b0f0af565e1a2f1ff9f1d Mon Sep 17 00:00:00 2001 From: Igor Barakaiev Date: Sun, 4 Aug 2024 01:50:44 +0300 Subject: [PATCH] fix: :error consistency in remove_keyword_key and argument_equals? in Config.configure (#68) --- lib/igniter/code/keyword.ex | 6 +++--- lib/igniter/project/config.ex | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/igniter/code/keyword.ex b/lib/igniter/code/keyword.ex index a69feea..5e42799 100644 --- a/lib/igniter/code/keyword.ex +++ b/lib/igniter/code/keyword.ex @@ -215,15 +215,15 @@ defmodule Igniter.Code.Keyword do if Igniter.Code.Tuple.tuple?(item) do case Igniter.Code.Tuple.tuple_elem(item, 0) do {:ok, first_elem} -> - Common.node_matches_pattern?(first_elem, ^key) + Common.nodes_equal?(first_elem, key) :error -> - false + :error end end end) do :error -> - {:ok, zipper} + :error {:ok, zipper} -> {:ok, zipper |> Zipper.remove()} diff --git a/lib/igniter/project/config.ex b/lib/igniter/project/config.ex index 5902d0f..14ea387 100644 --- a/lib/igniter/project/config.ex +++ b/lib/igniter/project/config.ex @@ -400,8 +400,8 @@ defmodule Igniter.Project.Config do :config, 3, fn function_call -> - Igniter.Code.Function.argument_matches_pattern?(function_call, 0, ^app_name) && - Igniter.Code.Function.argument_matches_pattern?(function_call, 1, ^config_item) + Igniter.Code.Function.argument_equals?(function_call, 0, app_name) && + Igniter.Code.Function.argument_equals?(function_call, 1, config_item) end ) do :error -> @@ -418,8 +418,8 @@ defmodule Igniter.Project.Config do :config, 3, fn function_call -> - Igniter.Code.Function.argument_matches_pattern?(function_call, 0, ^app_name) && - (Igniter.Code.Function.argument_matches_pattern?(function_call, 1, ^config_item) || + Igniter.Code.Function.argument_equals?(function_call, 0, app_name) && + (Igniter.Code.Function.argument_equals?(function_call, 1, config_item) || Igniter.Code.Function.argument_matches_predicate?( function_call, 1, @@ -448,7 +448,7 @@ defmodule Igniter.Project.Config do :config, 2, fn function_call -> - Igniter.Code.Function.argument_matches_pattern?(function_call, 0, ^app_name) + Igniter.Code.Function.argument_equals?(function_call, 0, app_name) end ) do :error ->