chore: cleanup code addition

This commit is contained in:
Zach Daniel 2024-07-02 17:20:50 -04:00
parent 6ad05df5db
commit 44ebb4d7b0
3 changed files with 5 additions and 4 deletions

View file

@ -147,7 +147,7 @@ defmodule Igniter.Code.Common do
current_code = Zipper.root(current_code)
case current_code do
{:__block__, meta, stuff} when length(stuff) > 1 ->
{:__block__, meta, stuff} when length(stuff) > 1 or length(stuff) == 0 ->
new_stuff =
if placement == :after do
stuff ++ [new_code]

View file

@ -334,7 +334,8 @@ defmodule Igniter.Code.Module do
# sobelow_skip ["DOS.StringToAtom"]
def move_to_module_using(zipper, module) do
with {:ok, mod_zipper} <- move_to_defmodule(zipper),
{:ok, _} <- move_to_using(zipper, module) do
{:ok, mod_zipper} <- Igniter.Code.Common.move_to_do_block(mod_zipper),
{:ok, _} <- move_to_using(mod_zipper, module) do
{:ok, mod_zipper}
else
_ ->

View file

@ -133,7 +133,7 @@ defmodule Igniter.Project.Deps do
if opts[:error?] do
{:error,
"""
Could not add dependency #{inspect({inspect(name), inspect(version)})}
Could not add dependency #{inspect({name, version})}
`mix.exs` file does not contain a simple list of dependencies in a `deps/0` function.
Please add it manually and run the installer again.
@ -142,7 +142,7 @@ defmodule Igniter.Project.Deps do
{:warning,
[
"""
Could not add dependency #{inspect({inspect(name), inspect(version)})}
Could not add dependency #{inspect({name, version})}
`mix.exs` file does not contain a simple list of dependencies in a `deps/0` function.