Skip to content

Commit

Permalink
fix: use new ignore_missing_sub_formatters option in rewrite
Browse files Browse the repository at this point in the history
this resolves case where a nested formatter file is added after
its parent .formatter.exs that references it

fixes #154
  • Loading branch information
zachdaniel committed Nov 25, 2024
1 parent 94d4a30 commit 1045aec
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/igniter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ defmodule Igniter do
rewrite:
Rewrite.new(
hooks: [Igniter.Rewrite.DotFormatterUpdater],
dot_formatter: Rewrite.DotFormatter.read!(nil, ignore_unknown_deps: true)
dot_formatter:
Rewrite.DotFormatter.read!(nil,
ignore_unknown_deps: true,
ignore_missing_sub_formatters: true
)
)
}
|> include_existing_elixir_file(".igniter.exs", required?: false)
Expand Down
5 changes: 4 additions & 1 deletion lib/igniter/rewrite/dot_formatter_updater.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ defmodule Igniter.Rewrite.DotFormatterUpdater do
end

defp dot_formatter(project) do
case DotFormatter.read(project, ignore_unknown_deps: true) do
case DotFormatter.read(project,
ignore_unknown_deps: true,
ignore_missing_sub_formatters: true
) do
{:ok, dot_formatter} -> dot_formatter
{:error, _error} -> DotFormatter.default()
end
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ defmodule Igniter.MixProject do
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:rewrite, "~> 1.0"},
{:rewrite, "~> 1.1 and >= 1.1.1"},
{:glob_ex, "~> 0.1.7"},
{:spitfire, "~> 0.1 and >= 0.1.3"},
{:sourceror, "~> 1.4"},
Expand Down

0 comments on commit 1045aec

Please sign in to comment.